1. Write pseudocode to calculate the weekly pay for employees. The user will prompted to
enter the number of hours worked and their job code. Hours in excess of 40 are paid at
1.5 times the hourly pay. Job code hourly
...
1. Write pseudocode to calculate the weekly pay for employees. The user will prompted to
enter the number of hours worked and their job code. Hours in excess of 40 are paid at
1.5 times the hourly pay. Job code hourly rates are: P - $10, Q - $12.50, R - $15.00, and S
- $20.00. Use both a case and a selection structure.
Module main()
Call Module hoursWorkedJobCode Call Module overtime
Call Module weeklyPay End Module
Module hoursWorkedJobCode() Declare Real numberOfHours Declare String jobCode
Display “Please enter the number of hours you have worked this week:” Input numberOfHours
Display “Please enter your job code P, Q, R, or S:” Input jobCode
End Module
Module overtime(Real numberOfHours, String jobCode) Declare Real excessHours
If numberOfHours > 40 Then
Set excessHours = (numberOfHours – 40) * 1.5
Else
End If End Module
Set excessHours = numberOfHours
Module weeklyPay (Real excessHours) Declare Real weeklyPayP Declare Real weeklyPayQ Declare Real weeklyPayR Declare Real weeklyPayS
Display “Please select your job code” Input jobCode
If jobCode == P Then
Set weeklyPayP = excessHours*10.00 Display “Your weekly pay is $” , weeklyPayP
Else If jobCode == Q Then
Set weeklyPayQ = excessHours*12.50 Display “Your weekly pay is $” , weeklyPayQ
Else If jobCode == R Then
Set weeklyPayR = excessHours*15.00 Display “Your weekly pay is $” , weeklyPayR
Else jobCode == S
Set weeklyPayS = excessHours*20.00 Display “Your weekly pay is $” , weeklyPayS
End If
End Module
2. At a college the tuition for 1 credit hour is $500, but student are given a discount based on the following:
Credit hours Discount
1-5 2%
6-10 5%
11-15 8%
16 or above 10%
Write pseudocode that will ask the user to enter the number of credit hours they are registered for, and then calculated the total cost, the discount, and the cost after the discount.
Module main()
Call Module creditHours Call Module discount Call Module totalPrice
End Module
Module creditHours()
Declare Integer numberOfCredits
Display “Please enter the number of credit hours you are registered for:” Input numberOfCredits
End Module
Module discount(Integer numberOfCredits) Declare Real discountRates1 Declare Real discountRates2
Declare Real discountRates3 Declare Real discountRates4
If numberOfCredits >= 1 AND <= 5 Then
Set discountRates1 = (numberOfCredits * 500 *0.02)
Display “This is the discount you will receive $”, discountRates1 Else If numberOfCredits >= 6 AND <= 10 Then
Set discountRates2 = (numberOfCredits * 500 *0.05)
Display “This is the discount you will receive $”, discountRates2 Else If numberOfCredits >= 11 AND <= 15 Then
Set discountRates3 = (numberOfCredits * 500 *0.08)
Display “This is the discount you will receive $”, discountRates3 Else numberOfCredits >= 16 AND <= 20 Then
Set discountRates4 = (numberOfCredits * 500 *0.1)
Display “This is the discount you will receive $”, discountRates4
End If End Module
Module totalPrice (Integer numberOfCredits, Real discountRates1, Real discountRates2, Real discountRates3, Real discountRates4)
Declare Real priceWithDiscount
Set priceWithDiscount = (numberOfCredits*500) - (numberOfCredits * 500 *0.1) Display “Your final price is $” , priceWithDiscount
End Module
3. Write pseudocode that will calculate a XXX% tip and a 6% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total.
The restaurant now wants to change the program so that the tip percent is based on the meal price. The new amounts are as follows:
Meal Price Range Tip Percent
.01 to 5.99 10%
6 to 12.00 13%
12.01 to 17.00 16%
17.01 to 25.00 19%
25.01 and more 22%
[Show More]