Advertisement
476179

MultipleNested.D2

Oct 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package lessons;
  2. import javax.swing.JOptionPane;
  3. //user inputs numerical grade, outpust a letter grade
  4. //a = 90-100
  5. //b = 80-89
  6. //c = 70-79
  7. //d = 60-69
  8. //f = <59
  9. //should display use or multiple nested
  10. public class MultipleNestedDecsionStructures
  11. {
  12.  
  13. public static void main(String[] args)
  14. {
  15. String s;
  16. int grade;
  17.  
  18. s = JOptionPane.showInputDialog("whats ur test score?");
  19. grade = Integer.parseInt(s);
  20.  
  21. if (grade > 59 )
  22. {
  23. if(grade > 69)
  24. {
  25. if(grade >79)
  26. {
  27. if(grade > 89)
  28. {
  29. JOptionPane.showMessageDialog(null,"your grade is: A");
  30. }
  31. else
  32. {
  33. JOptionPane.showMessageDialog(null,"your grade is: B");
  34. }
  35. }
  36. else
  37. {
  38. JOptionPane.showMessageDialog(null,"your grade is: C");
  39. }
  40. }
  41. else
  42. {
  43. JOptionPane.showMessageDialog(null,"your grade is: D");
  44. }
  45. }
  46. else
  47. {
  48. JOptionPane.showMessageDialog(null,"your grade is: F");
  49. }
  50. System.exit(0);
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement