Go Back   Tech Support Forum > The IT Pro > Programming

Help Java Program

This is a discussion on Help Java Program within the Programming forums, part of the Tech Support Forum category. Help me with my program My Professor Want me to do a Program that will Make the Program To Try


Reply
 
Thread Tools Search this Thread
Old 11-17-2011, 04:48 AM   #1
Registered Member
 
Join Date: Sep 2011
Posts: 4
OS: win7


Post

Help me with my program My Professor Want me to do a Program that will Make the Program To Try Again.. i wanted to be able to make it go from the start of the program again, instead of inputting the program again, basically like a restart command. anyone help?
thanks

This my code :
Code:
import java.util.Scanner;
    public class Prog2 {
    public static void main(String[]args) {
     
    Scanner input = new Scanner(System.in);
     
    int highestNum=0;
    int lowestNum =5000;
    int num, numTimes;
     
    System.out.println("How many numbers would you like to enter? ");
    numTimes = input.nextInt();
     
    for (int c=1; c <= numTimes; c++) {
    System.out.println("Please enter an integer !");
    num = input.nextInt();
    if (c == 1) {
    lowestNum = num;
    highestNum = num; }
    else {
    if (num < lowestNum) {
    lowestNum = num; }
    if (num > highestNum) {
    highestNum = num; }}}
    System.out.println("The higest number is " + highestNum);
    System.out.println("The lowest number is " + lowestNum);
    }
}

__________________
DarkFire08 is offline   Reply With Quote
Old 11-17-2011, 11:32 AM   #2
TSF-Emeritus
 
Ninjaboi's Avatar
 
Join Date: Dec 2010
Location: U.S.A., Texas
Posts: 2,047
OS: Windows XP SP3, Ubuntu 10

My System


Unfortunately, we are unable to help you with homework/school assignments as per the TSF rules stating:

Quote:
You may not ask for assistance with homework assignments, projects or book reports for school college or university
We can however give you a push in the right direction.

You should try Googling "Java Do-While Loop" and get some example code. Remember, Google is your friend.

__________________
Ninjaboi is offline   Reply With Quote
Old 11-19-2011, 06:22 PM   #3
Registered Member
 
Join Date: Apr 2010
Posts: 236
OS: Windows 7

My System


Although, as Ninjaboi said, we're unable to help you with homework assignments, there's a code tag for posting on forums. It's usually expected, and helpful for people reading the code.

Something like:
Code:
#Printing "Hello World!" in Python
print('Hello World!')
You do it like "code" with a /code (surrounded by [])
__________________
Crockeo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple Java EXCEPTION_ACCESS_VIOLATION notices
In the past month and a half, we've received 70 java EXCEPTION_ACCESS_VIOLATION notices. They appear as text files on our desktop and each has a different category number--e.g., hs_err_pid4156, hs_err_pid3300, etc. I don't know what they mean or what to do about them except to move them to a Java...
digit ally General Computer Security 6 10-24-2011 02:17 PM
Red signs, antivirus program gone crazy
I was on the internet when suddenly all these red virus infection warnings popped up from a program called System Smart Security. We never had this program. According to the properties for this program, it somehow got installed today. Now, it relentlessly has loads of warnings about infections on...
scott98 Windows XP Support 5 07-04-2011 06:26 AM
Please Help JAVA Related Errors
When I play Java applications such as Minecraft I get these notepads or 'errors' where the title of the notepad is hs_err_pid**** (**** are different numbers every time.) I'm sure it is a Java related issue. This is what the file says: # # A fatal error has been detected by the Java Runtime...
rowell PC Gaming Support 2 04-11-2011 12:52 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2


All times are GMT -7. The time now is 12:29 PM.


Copyright 2001 - 2014, Tech Support Forum

Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts