Module main // declare variables Declare Real loanpayment, insurance, gas, oil, tires, maintenance,sum
Date 19.05.2018 Size 7.81 Kb. #49346
http://www.justanswer.com/questions/3hbwy-for-john-d-design-a-modular-program-that-asks-the-user
Design a modular program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment , insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and the total annual cost of these expenses.
Module main()
// declare variables
Declare Real loanpayment, insurance, gas, oil, tires, maintenance,sum
// Display an intro message.
Call showIntro()
//getting loan payment expense as input
Display “Enter expense incurred from loan payment: “
Input loanpayment
//getting insurance expense as input
Display “Enter expense incurred from insurance: “
Input insurance
//getting gas expense as input
Display “Enter expense incurred from gas: “
Input gas
//getting oil expense as input
Display “Enter expense incurred from oil: “
Input oil
//getting tires expense as input
Display “Enter expense incurred from tires: “
Input tires
//getting maintenance expense as input
Display “Enter expense incurred from maintenance: “
Input maintenance
Sum = loanpayment + insurance + gas + oil + tires + maintenance
Call monthlyCost(Sum)
Call annualCost(Sum)
Call showEndMsg()
End main
Module showIntro()
Display “A program to calculate costs for expenses incurred from operating automobile”
End showIntro
monthlyCost(Real Sum)
Display “Total monthly cost of expenses incurred from operating automobile: “, Sum
End monthlyCost
annualCost(Real Sum)
Display “Total annual cost of expenses incurred from operating automobile: “, (Sum * 12)
End annualCost
showEndMsg()
Display “End of the program”
End showEndMsg Share with your friends:
The database is protected by copyright ©ininet.org 2024
send message