Advertisement
Guest User

Grading

a guest
Nov 15th, 2012
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. public class Grading {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. // get a score from the user
  8. String s = JOptionPane.showInputDialog("Please enter your grade");
  9. int grade=Integer.parseInt(s);
  10.  
  11. // convert the score into a letter grade
  12. if (grade >= 80) { // <<< removed semicolon here
  13. JOptionPane.showMessageDialog(null,"… scored 80 or above, you got grade A");
  14. } else if (grade >= 60) { // << removed semicolon here
  15. JOptionPane.showMessageDialog(null,"… got grade B");
  16. } else {
  17. JOptionPane.showMessageDialog(null, "… got less than a B");
  18. }
  19.  
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement