Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: Problem 1. Salary Computation Write a Python program called p1.py that computes the salary for a worker that is paid weekly. The p1 program

Python:

Problem 1. Salary Computation Write a Python program called p1.py that computes the salary for a worker that is paid weekly.

The p1 program starts by displaying some instructions to the user. Then it reads from the terminal (in this order!) the number of hours worked in a week (variable hours_worked, to convert to float), the hourly salary (rate_per_hour, float), and whether the worker has received a bonus (variable yes_no). If yes_no is y, then the program reads the bonus (in variable bonus, also converted to a float).

The program computes the total salary as the sum of the overtime salary, the non-overtime salary, and the bonus. At the end, the program displays the total salary and the overtime pay.

Any hours worked in a week above 40 will be paid with a salary rate that is 1.5 times the regular hourly rate.

Thus, if the number of hours worked is 45, the hour rate is $10/hour, and the bonus is $18, the overtime pay is (45 - 40) * 10 * 1.5 = 75, the non-overtime pay is 40 * 10 = 400, and the total salary is 75+400+18=$493.

With these parameters, the user session generates this output to the terminal, as follows. User input is shown in yellow and the character indicates the ENTER key typed by the user.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions