Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- import java.util.Scanner;
- class TuitionOCC
- {
- public static void main(String [] args)
- {
- Scanner scan = new Scanner(System.in);
- JOptionPane.showMessageDialog(null,"Calculate Your Tuition!");
- 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");
- double num = Integer.parseInt(a);
- if (num <= 3 && num > 0)
- {
- String b = JOptionPane.showInputDialog("How many credit hours are you taking?\n");
- double hours = Integer.parseInt(b);
- double x = (hours * 88);
- double y = (hours * 171);
- double z = (hours * 240);
- if (num == 1)
- JOptionPane.showMessageDialog(null,hours + " hours at $88.00 per hour yields a tuition of " + x);
- else if(num == 2)
- JOptionPane.showMessageDialog(null,hours + " hours at $171.00 per hour yields a tuition of " + y);
- else if (num == 3)
- JOptionPane.showMessageDialog(null,hours + " hours at $240.00 per hour yields a tuition of " + z);
- else if (num >= 4)
- JOptionPane.showMessageDialog(null,"Wrong");
- }
- else if (num >= 4||num <=-1)
- JOptionPane.showMessageDialog (null,"You must enter a 1,2 or 3.\n Please run the program again.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement