Create a file called PDP-gas-calc.docx. Use Program Development Plan template from D2L , Materials, Content, Resources,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Create a file called PDP-gas-calc.docx. Use Program Development Plan template from D2L , Materials, Content, Resources,

Post by answerhappygod »

Create a file called PDP-gas-calc.docx. Use Program Development Plantemplate from D2L , Materials, Content, Resources, Grading_PDPtemplate.• The PDP will cover a program called gas_calc.py, which asks the user 1) the numberof miles they drove on a trip, 2) the number of gallons of gas they used, and 3) theprice of gas per gallon. The program uses their input to figure out and display thecost of the trip & the miles per gallon (MPG) for the trip. See output format below.
Print the information into a nice looking table using python 3 formatting (adaptthe code from bus_fare2.py, done in class).
-----------------------------------------------------------------------
"""M. Bock 8/10/2019 This program calculates & displaysregular, overtime and gross pay - using a table format.Challenge - adapt it to fit regular and rush bus fares. """
# define variables & amounts providedreg_rate = 15.34ot_rate = reg_rate * 1.5reg_hours = 40ot_hours = 10
# calculate gross pay, saving detail for reg & ot payreg_pay = round(reg_hours * reg_rate, 2)ot_pay = round(ot_hours * ot_rate, 2)gross_pay = reg_pay + ot_paytotal_hours = reg_hours + ot_hours
# display the regular, OT and total pay in a table.print(f'Total pay for {total_hours} hours = ${gross_pay:,.2f}.')print('{:<14}{:>5}{:>12}{:>5}{:>14}{:>6}'.format('Type', 'Hours', '', 'Rates', '', 'Total'))print('{:<14}{:>5}{:>12}{:>5.2f}{:>14}{:>6.2f}'.format('Regular', reg_hours, '$', reg_rate, '$', reg_pay))print('{:<14}{:>5}{:>12}{:>5.2f}{:>14}{:>6,.2f}'.format('Overtime', ot_hours, '$', ot_rate, '$', ot_pay))
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply