Create the logic for a program that computes weekly salary. Include two overload
ID: 3634211 • Letter: C
Question
Create the logic for a program that computes weekly salary. Include two overloaded methods names computeWeeklySalary (). One version accepts an annual salary as a number and calculates weekly salary as 1/52 of the annual amount. The other accepts a number of hours worked per week and an hourly pay rate, and calculates weekly salary as a product of the two. Each method returns the weekly salary to the calling program. The main program prompts the user for the type of calculation to perform ; then, based on the user's responce, the program promts for appropriate data, calls the correct method. and displays the result.Explanation / Answer
Dear User,
start
Declare variables
num HoursPerWeek
num HourlyPayRate
num AnnualSalary
num totalAnnualSalary
num totalWeeklySalary
while is calculateWeeklySalry?
input HoursPerWeek
input HourlyPayRate
computeWeeklySalary(HoursPerWeek,HourlyPayRate)
end while
input AnnualSalary
computeWeeklySalary(AnnualSalary)
stop
computeWeeklySalary(HoursPerWeek,HourlyPayRate)
totalWeeklySalary= HoursPerWeek*HourlyPayRate
output totalWeeklySalary
return
computeWeeklySalary(AnnualSalary)
totalAnnualSalary=AnnualSalary/52
output totalAnnualSalary
return