Question

Program 5: Design (pseudocode) and implement (source code) a program (name it Weekl yHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers between 0 and 10 and then prints out the array in rows and columns as shown below. The main method then calls method addHours) that takes a two-dimensional array as a parameter and displays the total weekly hours for each employee as shown below. Document your code and properly label the outputs as shown below Sample run1: Employees Data: Mon Tue Wed Thu Fri Sat Sun Employeel 5 Employee2 7 Employee31 3 Employee# Weekly Hours 37 40 26 1 3 Sample run 2: Employees Data: Mon Tue Wed Thu Fri Sat Sun Employeel 10 2 Employee25 Employee3 1 Employee# Weekly Hours 32 24 3

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PSEUDO CODE:

import random
def main():
employees = [[random.randint(0,10) for j in range(10)] for i in range(3)]
print("{0:<10}{1:>4}{2:>4}{3:>4}{4:>4}{5:>4}{6:>4}{7:>4}".format(" "*10,'Mon','Tue','Wed','Thu','Fri','Sat','Sun'))
i = 1
for employee in employees:
name="Employee"+str(i)
print("{0:<10}{1:>4}{2:>4}{3:>4}{4:>4}{5:>4}{6:>4}{7:>4}".format(name,employee[0],employee[1],employee[2],employee[3],employee[4],employee[5],employee[6] ))
i += 1
print("-"*38)
print("{0:<10}{1:>28}".format("Employee#","Weekly Hours"))
i = 1
for employee in employees:
print("{0:<10}{1:>28}".format(i,sum(employee)))
i+=1
print("-" * 38)
main()

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Program 5: Design (pseudocode) and implement (source code) a program (name it Weekl yHours) to compute...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it...

    IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it WeeklyHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers’ daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers...

  • Code in Java and implement (source code) a program (name it WeeklyHours) to compute the total...

    Code in Java and implement (source code) a program (name it WeeklyHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers’ daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers between 0 and 10 and...

  • PSEUDOCODE and PYTHON source code! Program 4: Design (pseudocode) and implement (source code) a program (name...

    PSEUDOCODE and PYTHON source code! Program 4: Design (pseudocode) and implement (source code) a program (name it MinMaxAvg) to determine the highest grade, lowest grade, and the average of all grades in a 4-by-4 two-dimensional arrays of integer grades (representing 4 students’ grades on 4 tests). The program main method populates the array (name it Grades) with random grades between 0 and 100 and then displays the grades as shown below. The main method then calls method minMaxAvg()that takes a...

  • PLEASE DO THE PSEUDOCODE FOR THE PROGRAM BELOW Program 3: Design (pseudocode) and implement (source code)...

    PLEASE DO THE PSEUDOCODE FOR THE PROGRAM BELOW Program 3: Design (pseudocode) and implement (source code) a program (name it DistinctValues) to display only district values in an array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method getValues() that takes an integer array and returns another single-dimensional array containing only distinct values in the original (passed) array. Document...

  • C# ONLY INCLUDE BOTH PSUDEO CODE AND SOURCE CODE!!!! Design (pseudocode) and implement (source code) a...

    C# ONLY INCLUDE BOTH PSUDEO CODE AND SOURCE CODE!!!! Design (pseudocode) and implement (source code) a program (name it IndexOfLargest) to find the index of the first largest value in the array. Note that the largest value may appear more than once in the array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method findIndex() that takes a single-dimensional...

  • Write a C++ program that calculates the working hours of multiple employees during a weekday. The...

    Write a C++ program that calculates the working hours of multiple employees during a weekday. The program will take the last digits of your student id as the number of row employees of the array (if your last digits are less than or equal to 7 add 3 to it) and the weekdays are the column then fill the array with using random integer inputs (between 0 - 10 ) (stores the random numbers in a 2D array using both...

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:             0 Sunday                     1 Monday                   2 Tuesday                   3 Wednesday       4 Thursday                 5 Friday                      6 Saturday Your program should...

  • Write a C# program that prints a calendar for a given year. Call this program calendar....

    Write a C# program that prints a calendar for a given year. Call this program calendar. This program needs to use Switch Case in order to call the methods and format to print each month. The program prompts the user for two inputs:       1) The year for which you are generating the calendar.       2) The day of the week that January first is on, you will use the following notation to set the day of the week:      ...

  • I need help how to do the steps 9, 10, 11 A1 x Day A fx...

    I need help how to do the steps 9, 10, 11 A1 x Day A fx B C D E F G H I J K Afternoon Sales over $100 Shift Cups Sold Kids Sold Kids sold Cups sold (6 oz) (12 oz) 54 52 14 28 Hours Morning Afternoon Evening 1 Day 2 Sun 3 Sun 4 Mon 5 Mon 6 Tue 7 Tue 8 Wed 9 Wed | 10 Thu | 11 Thu 12 Fri 13 Fri 14...

  • IN PYTHON WITHOUT USING: .APPEND/ .SORT/ INSERT / .SPLIT Program 1: Design (pseudocode) and implement (source...

    IN PYTHON WITHOUT USING: .APPEND/ .SORT/ INSERT / .SPLIT Program 1: Design (pseudocode) and implement (source code) a program (name it Occurrences) to determine whether two two-dimensional arrays are equivalent or not. Two arrays are equivalent if they contain the same values in any order. The program main method defines two two-dimensional array of size 3-by-3 of type integer, and prompts the user to enter integer values to initialize the arrays. The main method calls method isEquivalent()that takes two two-dimensional...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT