Search:

Type: Posts; User: hhman1

Search: Search took 0.10 seconds.

  1. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    It is not working correctly. Say I enter the following numbers: 4 4 3 3 3 5 6 6 the program says:

    The largest number is 4
    The occurrence count of the largest number is 1
    The second largest...
  2. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    So I tried to assign values and now it prints out that max is the first number I type and that the occurrence is one.


    if(number != 0){

    if(number > max){

    max = number;

    ...
  3. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    Max and nextmax both have a value of 0. The variables should be assigned a value in


    if(number != 0){

    if(number > max){



    maxcount = 1;
  4. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    The if loops should assign values to the four variables all of which print as 0. For some reason they do not.
  5. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    Oops forgot a part, which I just edited in. And yes it compiles without errors.
  6. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    So I've changed quite a bit over the past few days and I'm on the verge getting it right. I still have a few problems though. My output is 0 regardless of the integers I put in. I changed the while...
  7. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    The new values would be:
    max =6, count=1
    nextMax = 5 count=2
  8. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    Haha I'm just getting more and more confused. Really wish I had a real life teacher. Here is what I now have but I don't think it makes sense.

    import java.util.Scanner;

    public class Unit4PT1 {...
  9. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    What I don't understand is how to assign a value to nextLargest. if(number > max) gives me largest but...
  10. Replies
    21
    Views
    1,312

    Re: Homework help using max method

    How would I compare the largest variable to the old largest? Here is what I now have

    import java.util.Scanner;

    public class Unit4PT1 {
    public static void main (String [] args){
    Scanner in =...
  11. Replies
    21
    Views
    1,312

    Homework help using max method

    Okay I've got a homework assignment to write a program that reads integers, finds the TWO (2) largest of them, and counts their occurrences. I've managed to get the largest number but can I get any...
Results 1 to 11 of 11