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

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


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?

This my 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
Sponsored Links
Old 11-17-2011, 10:32 AM   #2
Ninjaboi's Avatar
Join Date: Dec 2010
Location: Washington State, U.S.A.
Posts: 2,055
OS: Windows 7

My System

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

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, 05: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:
#Printing "Hello World!" in Python
print('Hello World!')
You do it like "code" with a /code (surrounded by [])
Crockeo is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
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 01: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 05: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-10-2011 11:52 PM

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

All times are GMT -7. The time now is 07:21 AM.

vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright 2001 - 2015, Tech Support Forum

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


Partially Powered By Products Found At Lampwrights.com