Java Practical 4 Qns 5
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package practical4;
import javax.swing.*;
/**
*
* @author p0852546
*/
public class ComputeIncomeTax {
public static void main(String[] args) {
int filer = Integer.parseInt(JOptionPane.showInputDialog(null , "Enter The Filing status: \n0 - Single Filers\n1 - Marrief filing jointly\n2 - head of household" , "input",2));
int taxable = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter The Taxable Income", "input",2));
int percent = 0;
if ( filer == 0 ) {
if ( taxable > 20000 ) {
percent = 27;
} else {
if ( taxable > 6000) {
percent = 15;
} else {
percent = 10;
}
}
} else {
if ( filer == 1) {
if ( taxable > 38000 ) {
percent = 23;
} else {
if ( taxable > 12000) {
percent = 13;
} else {
percent = 9;
}
}
} else {
if ( filer == 2 ) {
if ( taxable > 30000 ) {
percent = 21;
} else {
if ( taxable > 10000) {
percent = 11;
}else {
percent = 8;
}
}
}
}
}
double totaltax = ( taxable * percent / 100 ) ;
JOptionPane.showMessageDialog(null ,"Total Tax Payable = $"+totaltax);
}
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home