PayrollWithDecision Program
Description
This program inputs the hourly-paid employee's information (name, hours worked, and hourly rate), validates the user input, calculates the weekly pay including the overtime pay if applies, and prints the payroll report.Associated Concepts:
Two-way selection structure
Nested selection structure
Logical / Boolean operators
Nested selection structure
Logical / Boolean operators
Algorithm:
Declare variables to store name, hours worked, hourly rate,
and weekly pay
Read data values from the keyboard and store them into variables
If hours worked or hourly rate is less than or equal to 0
Print an error message
Otherwise, proceed to calculate the weekly pay
If the hours worked is greater than 40
Add the overtime pay to the regular pay
Otherwise, calculate the regular pay only
Print the payroll report
Read data values from the keyboard and store them into variables
If hours worked or hourly rate is less than or equal to 0
Print an error message
Otherwise, proceed to calculate the weekly pay
If the hours worked is greater than 40
Add the overtime pay to the regular pay
Otherwise, calculate the regular pay only
Print the payroll report