Guest User

Untitled

a guest
Feb 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. public class StudentGrade
  2. {
  3. int numResit = 0;
  4. int numPass = 0;
  5. int numDistinction = 0;
  6.  
  7. public void run()
  8. {
  9. Scanner key = new Scanner(System.in);
  10. int studMark = 0;
  11.  
  12. for(;;)
  13. {
  14. System.out.println("Enter a students mark! Enter negative to finish.");
  15. studMark = key.nextInt();
  16. if(studMark < 0) break;
  17. if(studMark < 40) numResit++;
  18. else if(studMark < 70) numPass++;
  19. else numDistinction++;
  20. }
  21.  
  22. System.out.println("Resits: " + numResit + " Passes: " + numPass + " Distinctions: " + numDistinction);
  23.  
  24. }
  25. }
Add Comment
Please, Sign In to add comment