Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Grading {
- public static void main(String[] args) {
- // get a score from the user
- String s = JOptionPane.showInputDialog("Please enter your grade");
- int grade=Integer.parseInt(s);
- // convert the score into a letter grade
- if (grade >= 80) { // <<< removed semicolon here
- JOptionPane.showMessageDialog(null,"… scored 80 or above, you got grade A");
- } else if (grade >= 60) { // << removed semicolon here
- JOptionPane.showMessageDialog(null,"… got grade B");
- } else {
- JOptionPane.showMessageDialog(null, "… got less than a B");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement