question archive Optional 2 Modify the Payroll and/or the MPG program to store the results in a list/dictionary

Optional 2 Modify the Payroll and/or the MPG program to store the results in a list/dictionary

Subject:Computer SciencePrice: Bought3

Optional 2

Modify the Payroll and/or the MPG program to store the results in a list/dictionary. Print the list/dictionary when no more calculation is selected.

mployee_name='John Doe'

 

Hours_worked = 4

 

Hourly_rate = 50

 

#compute and display employee pay.

 

pay = Hourly_rate*Hours_worked

 

# Display 

 

print("EMployee Name:",Employee_name,'nHours Rate:',Hourly_rate,'$ per hournHours Worked:',Hours_worked,'hours')

 

 

 

car_name='Avalon'

 

amount_of_gas_used = 20

 

no_of_miles = 5

 

#compute MPG

 

MPG = no_of_miles/amount_of_gas_used

 

print('Car name:',car_name,'nAMount of gas used:',amount_of_gas_used,'gallonsnMiles driven:',no_of_miles,'MilesnMiles per Gallon:',MPG)    

 

 

The output will be something like this for the payroll

Payroll for week xyz

James Bond ....... 21,500

Al Bundy ....... 500

Johnny English ..... 1,200

Total Payroll ....... 23,200

 

 

For the MPG will be something like

MPG for zyz truck

Week 1 ..... 12

Week 2 ..... 33

Week 3 ..... 27

MPG Ave ..... 24

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE