Find maximum of series of numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scAry008
    New Member
    • Aug 2007
    • 3

    Find maximum of series of numbers

    hi i am scAry,from phillipines.A beginner about java programming.Any body can help me? i need a code to how to write a java program that will ask for five numbers and will display the largest one by using DoWhile stament.....
    I hope can help me,reply as soon as possible.

    Thank you.
    God Bless us all!!
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Hi, I changed your topic title to something sensible so people might be interested
    to know what your question is about.

    kind regards,

    Jos

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by scAry008
      hi i am scAry,from phillipines.A beginner about java programming.Any body can help me? i need a code to how to write a java program that will ask for five numbers and will display the largest one by using DoWhile stament.....
      I hope can help me,reply as soon as possible.

      Thank you.
      God Bless us all!!
      Have you thought about this little problem yourself? Imagine that you can hold
      one number in each hand. I give you numbers, one by one, you have to drop
      one number and accept my new number; when I am out of numbers you're
      supposed to carry one number: the maximum value of all numbers. Try to
      visualize that process and you're almost in business.

      Pay special attention to the 'special cases' where I don't give you any number
      at all or just one number.

      kind regards,

      Jos

      Comment

      • kreagan
        New Member
        • Aug 2007
        • 153

        #4
        Originally posted by scAry008
        hi i am scAry,from phillipines.A beginner about java programming.Any body can help me? i need a code to how to write a java program that will ask for five numbers and will display the largest one by using DoWhile stament.....
        I hope can help me,reply as soon as possible.

        Thank you.
        God Bless us all!!
        Jos gave you the logic behind this question. I remember being new to java and being absolutely overwhelmed.

        Java API
        Take a look at the scanner class. This will allow you to take in input.

        System.out.prin tln( String ) is the command to output to the user.

        The rest is normal high level programming constructs such as for loop, do while loops and if statements. Hopefully this will give you enough information to research on your own.

        ~Kat

        Comment

        Working...