Question: Python 3, please. Please use the given hints and please do not use any array or functions concepts it should be purely based on loops
Python 3, please.
Please use the given hints and please do not use any array or functions concepts it should be purely based on "loops"
There are 6 employees. Write a program with nested loops, to ask the yearly salary of each employee for 5 years. Your program should keep track of the highest salary, lowest salary, and calculate the average salary of each employee. After you collect each employees data, display the highest salary, lowest salary, and average salary for that employee.
Hints: The outer loop is used to keep track of employees, and the inner loop is used to keep track of years for each employee of the outer loop.
In the test case below, please note that the employee count and year count keeps changing for input message and output messages
You can accomplish this by using an input and print statement like:
salary=input("Please enter employee "+ str(empcount) +" salary for year " + str( yearcount) + ": ")
print("Employee " + str(empcount) + " smallest salary is: $"+str(smallest) )
To calculate the average with decimal point, you can use statement like below.
avg=float(totalsal)/5
The above instructions are examples. Of course, you must replace the variables with the variables used in your program.
Test Case 1:
Please enter employee 1 salary for year 1: 45000 Please enter employee 1 salary for year 2: 66000 Please enter employee 1 salary for year 3: 23000 Please enter employee 1 salary for year 4: 54333 Please enter employee 1 salary for year 5: 88000 Employee 1 smallest salary is: $23000 Employee 1 highest salary is: $88000 Employee 1 average salary is: $55266.6 ********** Please enter employee 2 salary for year 1: 34000 Please enter employee 2 salary for year 2: 23000 Please enter employee 2 salary for year 3: 77000 Please enter employee 2 salary for year 4: 24000 Please enter employee 2 salary for year 5: 12000 Employee 2 smallest salary is: $12000 Employee 2 highest salary is: $77000 Employee 2 average salary is: $34000.0 ********** Please enter employee 3 salary for year 1: 34600 Please enter employee 3 salary for year 2: 65000 Please enter employee 3 salary for year 3: 54000 Please enter employee 3 salary for year 4: 99000 Please enter employee 3 salary for year 5: 23000 Employee 3 smallest salary is: $23000 Employee 3 highest salary is: $99000 Employee 3 average salary is: $55120.0 ********** Please enter employee 4 salary for year 1: 88000 Please enter employee 4 salary for year 2: 56000 Please enter employee 4 salary for year 3: 55000 Please enter employee 4 salary for year 4: 45557 Please enter employee 4 salary for year 5: 64000 Employee 4 smallest salary is: $45557 Employee 4 highest salary is: $88000 Employee 4 average salary is: $61711.4 ********** Please enter employee 5 salary for year 1: 56000 Please enter employee 5 salary for year 2: 89777 Please enter employee 5 salary for year 3: 67555 Please enter employee 5 salary for year 4: 45777 Please enter employee 5 salary for year 5: 87555 Employee 5 smallest salary is: $45777 Employee 5 highest salary is: $89777 Employee 5 average salary is: $69332.8 ********** Please enter employee 6 salary for year 1: 77666 Please enter employee 6 salary for year 2: 88777 Please enter employee 6 salary for year 3: 66555 Please enter employee 6 salary for year 4: 44555 Please enter employee 6 salary for year 5: 88999 Employee 6 smallest salary is: $44555 Employee 6 highest salary is: $88999 Employee 6 average salary is: $73310.4 **********
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
