Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StudentGrade
- {
- int numResit = 0;
- int numPass = 0;
- int numDistinction = 0;
- public void run()
- {
- Scanner key = new Scanner(System.in);
- int studMark = 0;
- for(;;)
- {
- System.out.println("Enter a students mark! Enter negative to finish.");
- studMark = key.nextInt();
- if(studMark < 0) break;
- if(studMark < 40) numResit++;
- else if(studMark < 70) numPass++;
- else numDistinction++;
- }
- System.out.println("Resits: " + numResit + " Passes: " + numPass + " Distinctions: " + numDistinction);
- }
- }
Add Comment
Please, Sign In to add comment