Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an ALGORITHM/PSEUDOCODE for each problem in JAVA. (NO program) just algori

ID: 3869434 • Letter: W

Question

Write an ALGORITHM/PSEUDOCODE for each problem in JAVA. (NO program) just algorithm/pseudocode please!

Problem 1:
Write a program that reads the ages of three persons from the user, and decides who is the oldest, and who the youngest person is.

Problem 2:
Write a program that reads in the name and salary of an employee. Here the salary will denote an hourly wage, such as $9.25. Then ask how many hours the employee worked in the past week. Be sure to accept fractional hours. Compute the pay. Any overtime work (over 40 hours per week) is paid at 150 percent of the regular wage. Print a paycheck for the employee.

Problem 3:
The original US income tax of 1913 was quite simple. The tax was:

1 percent on the first $50,000

2 percent on the amount over $50,000 up to $75,000

3 percent on the amount over $75,000 up to $100,000

4 percent on the amount over $100,000 up to $250,000

5 percent on the amount over $250,000 up to $500,000

6 percent on the amount over $500,000.

There was no separate schedule for single or married taxpayers. Write a program that computes the income tax according to this schedule.

Problem 4:
Write a program asks the user to enter a month (1 for January, 2 for February, and so on) and then prints the number of days in the month. For February, print "28 or 29 days".

For example:

Enter a month: 5
30 days

Do not use a separate if/else branch for each month. Use Boolean operators.

Problem 5:
A year with 366 days is called a leap year. Leap years are necessary to keep the calendar synchronized with the sun because the earth revolves around the sun once every 365.25 days. Actually, that figure is not entirely precise, and for all dates after 1582 the Gregorian corrections apply. Usually years that are divisible by 4 are leap years, for example 1996. However, years that are divisible by 100 (for example 1900) are not leap years, but years that are divisible by 400 are leap years (for example 2000). Write a program that asks the user for a year and computes whether that year is a leap year. Use a single if statement and Boolean operators.

Explanation / Answer

Program 1:

prompt for input of 3 numbers for 3 ages

store the input in no, no1, no2 type = int

declare variables younger and older type = int

if no > no1 && no > no2 => older = no

if no1 > no && no1 > no2 => older = no1

if no2 > no && no2 > no1 => older = no2

if no < no1 && no < no2 => younger = no

if no1 < no && no1 < no2 => younger = no1

if no2 < no1 && no2 < no => younger = no2

Program 2:

Prompt for name , wageHourly, workedHrs;
Initialize pay =0;
if(workedHrs>40)
pay = wageHourly * workedHrs *1.5;
else
pay = wageHourly * workedHrs;

Print Name and pay.

Problem 3:

welcome the user

prompt for input of inAmt type = double

store the input in constants inAmt

declare variable tax1 tax2 tax3 tax4 tax5 tax6 type = double set to 0

declare variable moreTax type = double set to 0

declare variable income type = double set to 0

if inAmt =< 50000 =>

tax1 = inAmt * .01

else if inAmt > 50000 && inAmt >= 75000 =>

tax1 = 50000 * .01

moreTax = inAmt - 50000

tax2 = moreTax * .02

else if inAmt > 75000 && inAmt >= 100000 =>

tax1 = 50000 * .01

tax2 = 25000 * .02

moreTax = inAmt - 75000

tax3 = moreTax * .03

else if inAmt > 100000 && inAmt >= 250000 =>

tax1 = 50000 * .01

tax2 = 25000 * .02

tax3 = 25000 * .03

moreTax = inAmt - 100000

tax4 = moreTax * .04

else if inAmt > 250000 && inAmt >= 500000 =>

tax1 = 50000 * .01

tax2 = 25000 * .02

tax3 = 25000 * .03

tax4 = 150000 * .04

moreTax = inAmt - 150000

tax5 = moreTax * .05

else if inAmt > 500000 =>

tax1 = 50000 * .01

tax2 = 25000 * .02

tax3 = 25000 * .03

tax4 = 150000 * .04

tax5 = 250000 * .05

moreTax = inAmt - 250000

tax6 = moreTax * .06

income = tax1 + tax2 + tax3 + tax4 + tax5 + tax6

output: You said your income was inAmt so your tax is income

Problem 4:

Welcome User
Prompt for month
if (month < 1 || month > 12)
print Invalid month number
if(month ==4 || month ==6 || month == 9 || month == 11)
print 30
else if (month == 2)
print 28 or 29
else
print 31

Problem 5:

welcome the user

prompt for input of yr type = int

store the input in constants yr

if yr < 1582

print "Please give the year after 1582. Thankyou"

else if ((yr % 4 == 0 && yr % 100 > 0) OR (yr % 400 == 0))

print "yr is a leap year"

else

print "yr is a leap year

Please rate the answer if it helped.....Thankyou

hope it helps....

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote