Problem: A company wants a program that will calculate the weekly paycheck for an employee based on how many hours they worked. For this company, an employee earns $20 an hour for the first 40 hours that they work. The employee earns overtime, $30 an hour, for each hour they work above 40 hours.
Example: If an employee works 60 hours in a week, they would earn $20/hr for the first 40 hours. Then they would earn $30/hr for the 20 hours they worked overtime. Therefore, they earned: ($20/hr * 40hrs) + ($30/hr * 20 hrs) = $800 + $600 = $1400 total.
For this assignment, you must create pseudocode and a flowchart to design a program that will calculate an employee’s weekly paycheck.
Psuedocode: INPUT number_of_hours; DECLARE weekly_pay, overtime_hours, overtime_pay; IF number_of_hours<=40: weekly_pay = number_of_hours * 20; ELSE: overtime_hours = number_of_hours - 40; overtime_pay = overtime_hours * 30; weekly_pay = (40*20) + overtime_pay;
Get Answers For Free
Most questions answered within 1 hours.