Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: MinMax

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    9
    My Mood
    Stressed
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default MinMax

    A tricky prob to tackle

    • Prompt user for integers using a loop
    • Stop prompting when a negative integer was entered
    • Print out the largest and smallest numbers entered so far
    • Print 0 as largest and smallest number when 1st number is -ve


    /*OUTPUT
    Enter number: 32
    Enter number: 23
    Enter number: 89
    Enter number: 2
    Enter number: -2
    Smallest number: 2
    Largest number: 89
    */


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: MinMax

    What problems are you having? What have you tried?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,262
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: MinMax

    This isn't a code service - no one is going to do this for you. Dumping homework such as this is unproductive at best. Make an attempt, and if you stumble along the way post a concise question along with code and any error messages.

  4. The Following User Says Thank You to copeg For This Useful Post:

    javaneedhelp (October 8th, 2011)

  5. #4
    Junior Member
    Join Date
    Oct 2011
    Posts
    9
    My Mood
    Stressed
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: MinMax

    My program is unable to prompt me for the next number when I enter a positive integer. Therefore, my smallest and largest integer are both the same number

  6. #5
    Member
    Join Date
    Oct 2010
    Location
    UK
    Posts
    42
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Re: MinMax

    Quote Originally Posted by javaneedhelp View Post
    My program is unable to prompt me for the next number when I enter a positive integer
    Sounds like an error with whatever loop you're using. Your best bet is to paste your attempted code here so everybody can take a look and guide you through your problem. It's hard to help when we can't see what you're doing

Similar Threads

  1. Java program to find the minimum and maximum values of input data
    By awake77 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 20th, 2008, 04:12 PM