Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. import java.util.Scanner;
  3. class TuitionOCC
  4. {
  5.  
  6. public static void main(String [] args)
  7. {
  8. Scanner scan = new Scanner(System.in);
  9.  
  10. JOptionPane.showMessageDialog(null,"Calculate Your Tuition!");
  11. String a = JOptionPane.showInputDialog("Are you a:\n 1-College District Resident\n 2-Non-Resident of College District\n 3-Out-of-State or International Student\n\n Enter a 1,2 or 3:\n");
  12. double num = Integer.parseInt(a);
  13.  
  14.  
  15. if (num <= 3 && num > 0)
  16. {
  17. String b = JOptionPane.showInputDialog("How many credit hours are you taking?\n","Tuition at OCC,QUESTION_MESSAGE );
  18. double hours = Integer.parseInt(b);
  19. double x = (hours * 88);
  20. double y = (hours * 171);
  21. double z = (hours * 240);
  22.  
  23. if (num == 1)
  24. JOptionPane.showMessageDialog(null,hours + " hours at $88.00 per hour yields a tuition of " + x);
  25. else if(num == 2)
  26. JOptionPane.showMessageDialog(null,hours + " hours at $171.00 per hour yields a tuition of " + y);
  27. else if (num == 3)
  28. JOptionPane.showMessageDialog(null,hours + " hours at $240.00 per hour yields a tuition of " + z);
  29. else if (num >= 4)
  30. JOptionPane.showMessageDialog(null,"Wrong");
  31.  
  32.  
  33. }
  34.  
  35. else if (num >= 4||num <=-1)
  36. JOptionPane.showMessageDialog (null,"You must enter a 1,2 or 3.\n Please run the program again.");
  37.  
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement