Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lessons;
- import javax.swing.JOptionPane;
- //user inputs numerical grade, outpust a letter grade
- //a = 90-100
- //b = 80-89
- //c = 70-79
- //d = 60-69
- //f = <59
- //should display use or multiple nested
- public class MultipleNestedDecsionStructures
- {
- public static void main(String[] args)
- {
- String s;
- int grade;
- s = JOptionPane.showInputDialog("whats ur test score?");
- grade = Integer.parseInt(s);
- if (grade > 59 )
- {
- if(grade > 69)
- {
- if(grade >79)
- {
- if(grade > 89)
- {
- JOptionPane.showMessageDialog(null,"your grade is: A");
- }
- else
- {
- JOptionPane.showMessageDialog(null,"your grade is: B");
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null,"your grade is: C");
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null,"your grade is: D");
- }
- }
- else
- {
- JOptionPane.showMessageDialog(null,"your grade is: F");
- }
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement