Java help!?

Discussion in 'School Work Help' started by Jokerjr, Mar 10, 2012.

  1. Jokerjr

    Jokerjr Member

    19
    26
    0
    I can't get my code to initiate into the if statement.. I need my program to tell me how many times an exam score over a hundred is entered. So like if 105 is entered 5 times it would say " exam scores over 100: 5...
     
  2. This part:
    Code:
    int x;
    int sum;
    int count;
    int hi;
    int low;
    int hundred;
    double average;
    int countx;
    count = 0;
    sum = 0;
    hi = 0;
    low = 100;
    hundred = 100;
    countx = 0;
    
    can be written as:

    Code:
    int x;
    int sum = 0;
    int count = 0;
    int hi = 0;
    int low = 100;
    int hundred = 100;
    double average;
    int countx = 0;
    
    What's the purpose of line 37:

    Code:
    hundred = x;
    
    Why are you modifying the variable "hundred" and why does the value 100 need to be stored in a variable?
     
  3. sorjaii

    sorjaii Member

    23
    229
    0
    countxx++ should be inside the braces for the if,not outside it
     
  4. It's inside the if already. It's hundred = x that should be removed, or inside the if
     
  5. Jokerjr

    Jokerjr Member

    19
    26
    0
    Whoops.. my if statement was screwing me up.. the condition was what made it go straight to the else statement... now i just need to find a way to initialize the if statement...