Created
September 7, 2012 21:51
-
-
Save wowmindy/3670021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DecimalFormat; | |
import java.util.Scanner; | |
/*P2 | |
* Mindy Mach | |
* mach@cs.colostate.edu | |
* 9/4/12 | |
* Recitation 2 | |
* CS160 | |
*/ | |
public class P2 { | |
public static void main(String[] args) { | |
int exemp; | |
double grosal, incom, cgain, chari, t, a, b, c, tot; | |
//Scanner initialization | |
Scanner keyboard = new Scanner(System.in); | |
System.out.print("Number of Exemptions: "); | |
exemp = keyboard.nextInt(); | |
System.out.print("Gross Salary: "); | |
grosal = keyboard.nextDouble(); | |
System.out.print("Interest income: "); | |
incom = keyboard.nextDouble(); | |
System.out.print("Capital Gains: "); | |
cgain = keyboard.nextDouble(); | |
System.out.print("Charitable Contributions: "); | |
chari = keyboard.nextDouble(); | |
t = (grosal + incom + cgain); | |
System.out.println("Total Income: $" + t); | |
System.out.println("Adjusted Income: $" + (t-(exemp *1500)- chari)); | |
double adj = (t-(exemp *1500)- chari); | |
a=0; b= 0; c = 0; | |
if( adj > 10000) | |
{ | |
if( adj < 32000) | |
{ | |
a = (adj - 10000) * 0.15; | |
} | |
else | |
{ | |
a = (22000* 0.15); } | |
} | |
if (adj > 32000) | |
{ | |
if(adj < 50000) | |
{ | |
b = (adj - 32000) * .23; | |
} | |
else | |
{ | |
b = 18000 * 0.23;} | |
} | |
if ((adj > 50000)) | |
{ | |
c = ((adj- 50000) * 0.28); | |
} | |
DecimalFormat fmt = new DecimalFormat( "#.00" ); | |
tot = (a + b + c); | |
System.out.println("Total Tax: $" + fmt.format(tot)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment