1/
Write a Java program that reads in a Name and Age (in years) of four persons and prints the name and age of the youngest person. Assume that all persons are of different age. The sample program run must look as follows:
Enter the name of the person: John
Now enter his/her age: 40
Enter the name of the person: Jenny
Now enter his/her age: 20
Enter the name of the person: Alex
Now enter his/her age: 33
Enter the name of the person: Joe
Now enter his/her age: 36
Jenny is the youngest person with the age 20
Note that the user input is in bold.
2/
When you fill out one’s income tax, you take your income, subtract certain amounts (personal exemption, a standard deduction, gifts to charity, etc), and compute your net taxable income. Given your net income, your tax is computed using the following table (for 2010):
MarginalTax Rate Single Filers
10% Not over $8,375
15% $8,375 – $34,000
25% $34,000 – $82,400
28% $82,400 – $171,850
33% $171,850 – $373,650
35% Over $373,650
For example, if your net income is $22,000, your tax is
10% of 8,375 + 15% of (22,000 8,375)
which computes to $2,881.25.
Write a Java program that reads in a person’s net taxable income, and prints the amount of tax using the above table. A sample program run is as follows:
Enter your net taxable income: 22000
Your tax is $2,881.25
Note that the user input is in bold. You can use
DecimalFormat df = new DecimalFormat("$###,###.##");