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 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 run 1:
Employees Data:
Mon Tue Wed Thu Fri Sat Sun
Employee1 5 3 2 9 6 5 7
Employee2 7 6 8 5 5 4 5
Employee3 1 2 2 1 5 8 7
Employee# Weekly Hours
----------------------------
1 37
2 40
3 26
Sample run 2:
Employees Data:
Mon Tue Wed Thu Fri Sat Sun
Employee1 10 2 7 2 0 3 8
Employee2 5 6 1 5 1 4 2
Employee3 1 5 2 6 4 8 7
Employee# Weekly Hours
----------------------------
1 32
2 24
3 33
IN PYTHON WITHOUT USING: .APPEND/ .SORT/ INSERT / .SPLIT
now we are doing this problem using binary searching
Program 2:
The program prints out the day an employee worked most hours (use Binary searching to implement this functionality)
The program outputs are displayed in ascending order (stored) by Weekly Hours. Notice that we modifying method addHours()to display the outputs sorted by total weekly hours for each employee as shown below.
Sample run 1:
Employees Data:
Mon Tue Wed Thu Fri Sat Sun
Employee1 5 3 2 9 6 5 7
Employee2 7 6 8 5 5 4 5
Employee3 1 2 2 1 5 8 7
Employee1 worked most hours on Thursday
Employee2 worked most hours on Wednesday
Employee3 worked most hours on Saturday
Employee# Weekly Hours
----------------------------
3 26
1 37
2 40
Sample run 2:
Employees Data:
Mon Tue Wed Thu Fri Sat Sun
Employee1 10 2 7 2 0 3 8
Employee2 5 6 1 5 1 4 2
Employee3 1 5 2 6 4 8 7
Employee1 worked most hours on Monday
Employee2 worked most hours on Tuesday
Employee3 worked most hours on Saturday
Employee #Weekly Hours
--------------------------------------
2 24
1 32
3 33
Pseudo Code:
Generate a random number between 0 to 10
Add it to the array
Print the number according to employee
Call the method to add employee weekly hours
Add the hours
Print the result
Program:
Part 1of the question has been solved:
import random
def main():
print("Employees Data:")
print(" Mon Tue Wed Thu Fri Sat Sun")
empWorkList = []
for employee in range(3):
dataOfEmp = ("Employee"+str(employee+1)+" ")
empWorkHours=[]
for days in range(7):
workingHour = random.randint(0,10)
empWorkHours.append(workingHour)
dataOfEmp += str(workingHour) +" "
if(len(str(workingHour))==1):
dataOfEmp+=" "
print(dataOfEmp)
empWorkList.append(empWorkHours)
print("\n")
print("Employee# Weekly Hours")
print("----------------------------")
addHours(empWorkList)
def addHours(empWorkList):
i=1
for empWorkHours in empWorkList:
print("Employee"+str(i) +" " + str(sum(empWorkHours)))
if __name__ == "__main__":
main()
IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it...
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...
A local franchise of a national chain of day-old pastry stores recorded the number of customers that came in to the store for five weeks this fall. The national franchisor states that the percentage of customers is distributed as follows: Sunday – 20%, Monday – 8%, Tuesday – 6%, Wednesday – 7%, Thursday – 12%, Friday – 22%, Saturday – 25%. The manager doesn’t trust the franchisor and wants to show his store has different percentages. Use a χ² Goodness-of-Fit...
A local franchise of a national chain of day-old pastry stores recorded the number of customers that came in to the store for five weeks this fall. These data are recorded in the attached file. The national franchisor states that the percentage of customers is distributed as follows: Sunday – 20%, Monday – 8%, Tuesday – 6%, Wednesday – 7%, Thursday – 12%, Friday – 22%, and Saturday – 25%. The manager doesn’t trust the franchisor and wants to show...
Work Scheduling: Burger Queen would like to determine the min # of kitchen employees. Each employee works six days a week and takes the seventh day off. Days Mon Tue Wed Thu Fri Sat Sun Min. # of workers 6 9 How do yu forulaic: ihis problem The objective function? The constraints? Work Scheduling: Burger Queen would like to determine the min # of kitchen employees. Each employee works six days a week and takes the seventh day off. Days...
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...
c++ What is the value of "Wed" given the following: enum DAYS { Sun, Mon = 0, Tue = 4, Wed, Thu = 7, Fri, Sat } Select one: a. 10 b. -1 c. 5 d. 6 What returns the number of bytes in a data type or variable? Select one: a. bytesize b. length c. sizeof d. bytes
Help with Python problem. ###################################### Q3 ############################### dowt = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat') # day-of-week-tuple, # year = 2020 cnt = 3 # 2020/1/1 is a Wednesday, so let us start a counting index of 3 for Wednesday, and keep adding one # m = 3 # this will be a variable to be looped through eventually. I use the convention of 0–11 for the twelve months # # As the cnt value changes, we want to...
#2 A For the full Heaven! Chocolates data set, fill in the correlation table (to two decimals) Time Pages Amt Spent Time Pages Amt Spent #2.B which variables, if any, are correlated under the 0.7 rule? #3.A Fill in the mean values of Time and Amt Spent by day of the week (to two decimals): Time Amt Spent Sun Mon Tue Wed Thu ! Fri Sat 6.50 #3.8 The greatest mean value of Time, which is a demand on the...
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...
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...