EECS 1510 Project 3: If Statements solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (5 votes)

Program 1: (20 points) ConvertToUpper.java
Write a Java program that reads in a character, presumably a letter, and prints the
uppercase equivalent of the letter. If the character is not a letter, the program simply prints a
message indicating this. One sample program run must look as follows:
Enter a letter: h
The uppercase equivalent of h is
H
The other sample program run must be as follows:
Enter a letter: $
Not a letter.
Note that the user input is in bold. Name this program as ConvertToUpper.java.
Program 2: (40 points) Circle.java
Write a simple program to determine if a point lies within a circle of radius 10.0
centered at the origin. (See Exercise 3.22 on page 112 of the textbook.) For the 2 sample
runs, give exactly the same input-output dialog below.
Enter a point with two coordinates: 4 5
Point (4, 5) is in the circle.
Enter a point with two coordinates: 9 9
Point (9, 9) is not in the circle.
10 points extra credit: Use JOptionPane for the input/output.
Program 3: (30 points) ThreeGuesses.java . Consider the following dialog:
Welcome to People’s Bank.
Please enter your secret code: 45
Sorry, that is not it. Try again: 47
Sorry, last chance. Try again: 51
Fine, go ahead.
Here the user gets three (and only three) tries to guess the secret code (here 51). Write a
program to give exactly this behavior. Do NOT use loops. For the printout of the 2 sample
runs, give one for a correct secret code on the third try (as above), and one for an incorrect
code an all three tries.
Program 4: (40 points) Taxes.java
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 2014):
Marginal
Tax Rate Single Filers
10% Not over $9,275
15% $9,276 – $37,650
25% $37,651– $91,150
28% $91,151 – $190,150
33% $190,151 – $413,350
35% $413,351 – $415,050
39.6 Over $415,050
For example, if your net income is $22,000, your tax is
10% of 9,275 + 15% of (22,000  9,275)
which computes to $2,836.25
Write a program that reads in a person’s net taxable income, and prints the amount of tax
using the above table. You need only include inomes below $190,000. A sample program run
is as follows:
Enter your net taxable income: 22000
Your 2014 tax is $2,836.25
The user input above is in bold. Name this program as Taxes.java. For the output of the
money amount, you need not put the comma in 2,836.25, just print 2836.25.
Option: You can use
DecimalFormat df = new DecimalFormat(“$###,###.##”);
to print the resulting tax in a reasonable notation for money amounts.
Hint: See Listing 3.5 ComputeTax.java in the text by Liang.