Search:

Type: Posts; User: hhman1

Search: Search took 0.10 seconds.

  1. Replies
    21
    Views
    351

    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
    351

    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
    351

    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
    351

    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
    351

    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
    351

    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
    351

    Re: Homework help using max method

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

    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
    351

    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
    351

    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
    351

    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...
  12. Replies
    4
    Views
    214

    [SOLVED] Re: Homework assistance

    Managed to solve my problem :)
  13. Replies
    4
    Views
    214

    [SOLVED] Homework assistance

    I'm just starting out at Java programming so my problem is likely obvious. The program needs to prompt the user to enter an integer and checks whether the number is divisible by 4, 5 and 6, or some...
  14. Replies
    2
    Views
    183

    Hello to you all

    Just wanted to say hello to the community. I'm currently learning Java programming as a hobby which I hope to expand upon in the coming years. I'm pretty sure I'll be coming here frequently as I...
Results 1 to 14 of 14