Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class age {
- public static void main(String[] args) {
- String SAmount;
- double age =0;
- double pay =0;
- double tax =0;
- SAmount = JOptionPane.showInputDialog(null,"Please enter your age", "AMOUNT", JOptionPane.QUESTION_MESSAGE);
- age = Double.parseDouble(SAmount);
- SAmount = JOptionPane.showInputDialog(null,"Please enter your pay", "AMOUNT", JOptionPane.QUESTION_MESSAGE);
- pay = Double.parseDouble(SAmount);
- if (age < 0){
- System.out.println ("One of the values is not valid");
- }
- else if (age < 18){
- System.out.println ("You owe nothing");
- }
- else if (age <= 25){
- tax = (int) (pay * 0.25);
- System.out.println ("You owe 25% in taxes $" + tax);
- }
- else if (age <= 35){
- tax = (int) (pay * 0.35);
- System.out.println ("You owe 35% in taxes $" + tax);
- }
- else if (age <= 55){
- tax = (int) (pay * 0.55);
- System.out.println ("You owe 45% in taxes $" + tax);
- }
- else if (age <= 64){
- tax = (int) (pay * 0.64);
- System.out.println ("You owe 20% in taxes $" + tax);
- }
- else{
- System.out.println ("You owe nothing");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement