程序代写代做代考 Programming Exercise 3-1

Programming Exercise 3-1

Programming Exercise 3-4

# main module

def main():

# Local variables

loan = 0.0

insurance = 0.0

gas = 0.0

oil = 0.0

tires = 0.0

maintenance = 0.0

# Get the amount of the loan payment.

loan = float(input(‘Enter the monthly loan amount: ‘))

# Get the amount of insurance.

insurance = float(input(‘Enter the monthly insurance’ \

‘ amount: ‘))

# Get the amount of gas.

gas = float(input(‘Enter the monthly gas amount: ‘))

# Get the amount of oil.

oil = float(input(‘Enter the monthly oil amount: ‘))

# Get the amount for tires.

tires = float(input(‘Enter the monthly tires amount: ‘))

# Get the amount for maintenance.

maintenance = float(input(‘Enter the monthly maintenance’ \

‘ amount: ‘))

# Print information about the vehicle.

showExpenses(loan, insurance, gas, oil, \

tires, maintenance)

# The showExpenses function accepts loan, insurance,

# gas, oil, tires, and maintenance information as

# arguments and displays the equivalent total expense

# information.

def showExpenses(loan, insure, gas, oil, \

tires, maintenance):

# Local variables

totalMonth = 0.0

totalYear = 0.0

totalMonth = loan + insure + gas + oil + \

tires + maintenance

totalYear = totalMonth * 12

# Print monthly and annual information.

print (‘Total monthly expense: $’, \

format(totalMonth, ‘,.2f’), \

sep=”)

print (‘Total annual expense: $’, \

format(totalYear, ‘,.2f’), \

sep=”)

# Call the main function.

main()

main()

getLoan

(loan)

Declare

Purchase, stateTax,

countyTax

showExpenses(loan,

insure, gas, oil, tires,

maintenance)

Return

Set totalMonth = loan +

insure + gas + oil +

tires + maintenance

Display

“Total Monthly Expense: $”,

totalMonth

Display “Total Yearly

Expense: $”, totalYear

Declare

totalMonth,

totalYear

getInsure

(insurance)

getGas

(gas)

Set totalYear =

totalMonth * 12

A

getOil

(oil)

getTires

(tires)

getMaintenance

(maintenance)

A

End

getLoan

(Ref loan)

Return

Display “Enter

the monthly

loan amount

Input

loan

getInsure

(Ref insurance)

Return

Display “Enter the

monthly insurance

amount

Input

insurance

getGas

(Ref gas)

Return

Display “Enter

the monthly

gas amount

Input

gas

getOil

(Ref oil)

Return

Display “Enter

the monthly oil

amount

Input

oil

getTires

(Ref tires)

Return

Display “Enter

the monthly

tires amount

Input

tires

getMaintenance

(Ref maintenance)

Return

Display “Enter the

monthly maintenance

amount

Input

maintenance