# Problem in an exercise

• 11-10-2010, 10:01 PM
Honest989
Problem in an exercise
So folks. I am on a course trying to learn Java. It scares me because I still don't totally understand all the concepts, and making a driver file is beyond me as yet but I have a question. We have an exercise to

Design and implement a marks grading program. The program should prompt the user to enter a sequence of integer marks in the range 0 .. 100. The sequence will be terminated by a sentinel value -1.

Marks will be graded according to the scheme:
Mark Range 0 .. 39 40 .. 59 60 .. 79 80 .. 100
```import java.util.Scanner; public class Exercise5 {   public static void main(String[]args)   {   int iNumber;   int iInputs =0;   double dAverage =0.0;   int iTotal =0;   int iA = 0;   int iB = 0;   int iC = 0;   int iD = 0;       System.out.println("Input next grade:\n");       Scanner input= new Scanner(System.in);       iNumber=input.nextInt(); //public void Determine(){}   for(iNumber =0; iNumber >=0; iInputs++)         {           if(iNumber > 100)           System.out.println("Number cannot be greater than 100, please try again \n");           if(iNumber >=80 && iNumber <=100)           iA++;           iInputs++;           if(iNumber >=60 && iNumber <=79)           iB++;           iInputs++;           if(iNumber >=40 && iNumber <=59)           iC++;           iInputs++;           if(iNumber >=0 && iNumber <=39)           iD++;           iInputs++;         }         dAverage = iTotal / iInputs; System.out.printf("Number of inputs was:%d\n" +                   "Total of Grades was:%d\n" +                   "Number of A's:%d\n" +                   "Number of B's:%d\n" +                   "Number of C's:%d\n" +                   "Number of D's:%d\n" +                   "Average of Grade Score was %d\n",iInputs, iTotal, iA, iB, iC, iD, dAverage);   }   }```