1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
uranmaximum [27]
4 years ago
4

Python Assume the input data is structured as follows: first there is a non-negative integer specifying the number of employee t

imesheets to be read in. This is followed by data for each of the employees. The first number for each employee is an integer that specifies their pay per hour in cents. Following this are 5 integers, the number of hours they worked on each of the days of the workweek. Given this data, write a loop and any necessary code that reads the data and stores the total payroll of all employees into the variable total. Note that you will have to add up the numbers worked by each employee and multiply that by that particular employee's pay rate to get the employee's pay for the week-- and sum those values into total.
Computers and Technology
1 answer:
AnnyKZ [126]4 years ago
3 0

Answer:

total_hours = 0

total = 0

n = int(input("Enter the number of employees: "))

for i in range(n):

   pay = int(input("Enter the pay per hour in cents of the " + str(i+1) + ". employee: "))

   for j in range(5):

       hour = int(input("Enter the work hour in " + str(j+1) + ". day: "))

       total_hours +=hour

   total += pay * total_hours

   total_hours = 0

print(total)

Explanation:

Initialize the total hours and total as 0

Ask the user to enter the number of employees

Create a nested for loop. The outer loop iterates depending on the number of employees. The inner loop iterates for each work day.

Inside the outer loop, ask the employee's pay per hour. Then, inside the inner loop, ask for the work hours for 5 days. Sum the hours and assign the value to total hours.

When inner loop is done, multiply the pay with total hours to calculate the pay and add this value to the total for each employee. Also, set the total hours as 0 (For the next employee, total hours will be zero at the beginning).

When the loops are done, print the total

You might be interested in
....................................................
labwork [276]

Answer:

.........................................................

Explanation:

8 0
3 years ago
Consider the following code example:
vampirchik [111]

Answer:

This exercise includes the following question and options:

What is the logical error in the coded query?

A) <em>The condition in the WHERE clause should be coded in the HAVING clause.</em>

B) <em>The column name for the fifth column in the result set doesn't match the data.</em>

C) <em>The three columns in the ORDER BY clause should use the DESC keyword so the city totals will be in the right sequence.</em>

D) <em>The condition in the HAVING clause should be coded in the WHERE clause.</em>

And from the options provided, the error is in the 5th column, due to the column name in that result series/group doesn't really coincide with the data, thereby the correct option is <em>B)</em>.

3 0
3 years ago
How many different Microsoft Windows file types can be infected with a virus?
vagabundo [1.1K]
Phishing, scam, Fraud, just to get to hack your computer.
6 0
3 years ago
What are the data type(s) will be used to declare the variable(s) needed to
postnew [5]
The three primitive data types used in this course are int (integer numbers), double (decimal numbers), and boolean (true or false). Each variable has associated memory that is used to hold its value.
4 0
3 years ago
How many generations of computers languages have there been since the middle of the 20th century
Molodets [167]
<span>There are 4 computer language generations. First is the first generation language or 1GL, second is the second-generation languages or the 2GL, next is the third-generation languages or the 3GL, and the last is fourth-generation languages or the 4GL.</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • The equation y=2x+1 represents a function true or false
    11·1 answer
  • g Write a program that prompts the user to enter two integers. The program outputs how many numbers are multiples of 3 and how m
    11·1 answer
  • All of the following are typical characteristics of internet predators, except white. male. between the ages of 18 and 35. high
    7·1 answer
  • This procedure protects against the loss of data
    5·1 answer
  • Which of the following is the definition of Internet Protocol Security ( IPSec)? A remote access client/server protocol. It is a
    13·2 answers
  • The part of a door frame that comes in contact with the door is the _________.
    12·1 answer
  • Which of the following is not a reserved keyword in python?​
    13·1 answer
  • Help it’s an exam brainleist
    8·1 answer
  • PLEASE HELP URGENT!!
    5·2 answers
  • 13. You're emailing your grandparents. Which of the following is the best example of digital etiquette?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!