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

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

Note that the user input is in bold. You can use
DecimalFormat df = new DecimalFormat("\$###,###.##");

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Ezzaral

If you as you claim

I try both of them many times, but nothing can work!

then why don't you post your code and we will try to solve it that way instead of giving you whole solution.

Forum rule states - We only give homework help to those who show effort

I think the user name should be "baloney", which is exactly what the claim that he's tried this is.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.