In: Computer Science
Q2. Design a Pearson modular program that asks the user to enter the monthly costs for each of the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, and maintenance (create a module for each expense). The program should then display the total monthly cost of these expenses, and the total annual cost of these expenses in the main Module. Use Pass arguments By Reference method to design your modules. Submit your pseudocode with comments at appropriate places.
Pseudocode
void expense_automobile()
{
Declare floating type variable auto;
input the value of expenses_ automobile // input value//
store value in auto variable //store value //
}
void expense_loanpay()
{
Declare floating type variable loan;
input the value of expenses_ laonpayment // input value//
store value in loan variable // store value//
}
void expense_insurance()
{
Declare floating type variable ins;
input the value of expenses_ insurance //input value//
store vaue in ins variable // store value//
}
void expense_Gas()
{
Declare floating type variable gas;
input the value of expenses_ gas //input value//
store vaue in gas variable // store value//
}
void expense_maintenance()
{
Declare floating type variable maintain
input the value of expenses_ maintenance //input value//
store vaue in maintain variable // store value//
}
int calculate_Monthlycost()
{
declare floating type variable Cost
cost = auto +gas+ins+loan+maintain // Calculation//
return cost
}
main()
{
declare floating type variable monthlycost,yearlycost
expense_automobile() // calling function module//
expense_loanpay()
expense_insurance()
expense_Gas()
expense_maintenance()
monthlycost= calculate_Monthlycost()
yearlycost = monthlycost *12 // calculate yearly cost//
Dispaly the monthlycost // Displaying the expenses monthly//
Display the yearlycost // Displaying the expenses yearly //
}