Question

In: Computer Science

Q2. Design a Pearson modular program that asks the user to enter the monthly costs for...

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.

Solutions

Expert Solution

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 //

}


Related Solutions

Design a modular program which asks the user to enter a list of numbers. The numbers...
Design a modular program which asks the user to enter a list of numbers. The numbers must be stored in an array. The program then finds the index of the first occurrence of the smallest element in the array and the last occurrence of the largest element in the array. The program displays the position and value of each of these items.
In Python write a program that asks the user to enter the monthly costs for the...
In Python write a 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. your program MUST have BOTH a main function AND a function named calcExpenses to calculate the expenses. DO NOT display the expenses inside of the calcExpenses function!!...
Write a C++ program that asks the user to enter the monthly costs for the following...
Write a C++ program that asks the user to enter the monthly costs for the following expenses incurred from operating your automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, and a projected total annual cost of these expenses. Label each cost. The labels should be left aligned and have a column width of 30 characters. The cost should be aligned right and displayed with two decimal places...
Write a program that asks the user to enter the monthly costs for the following expenses...
Write a 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 Maintenance Write a function that takes these six items as arguments and computes the total cost of these expenses. Write a main program that asks the user for these six items and calls your function. Print total monthly cost and the total annual cost for these expenses.
Write a program that asks the user to enter the monthly costs for the following expenses...
Write a 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. Using the following test data: 310.34 104.95 78.34 12.34 8.12 45.00 Your output should look like this: Enter the monthly loan payment amount: Enter the monthly cost of insurance:...
Please write in python Use modular design to write a program that asks the user to...
Please write in python Use modular design to write a program that asks the user to enter his or her weight and the name of a planet. The program then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet. PLANET CONVERSION FACTOR Mercury 0.4155 Venus 0.8975 Earth 1.0000 Moon 0.1660 Mars 0.3507 Jupiter 2.5374 Saturn 1.0677 Uranus 0.8947 Neptune 1.1794 Pluto 0.0899 The...
Design a complete program that asks the user to enter a series of 20 numbers. The...
Design a complete program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display each of the following data: I. The lowest number in the array II. The highest number in the array III. The total of the numbers in the array IV. The average of the numbers in the array *PYTHON NOT PSUEDOCODE AND FLOW CHART!!!!*
In python, write a program that asked the user to enter the monthly costs for the...
In python, write a program that asked the user to enter the monthly costs for the following expenses incurred from operating his automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should display total monthly cost and annual cost. Also, should contain main and calcExpenses functions, calcExpenses should only calculate the expenses and everything else should happen in the main function.
Design, plan, test, and write a computer program in Java that asks the user to enter...
Design, plan, test, and write a computer program in Java that asks the user to enter 1 number and a String. You will display the first n characters of the string where n is the number entered. For example, if the user enters 3 and java then you will print jav. If they enter 5 and Halloween then you print Hallo. If the user enters a number less than 0 then set the number to 0. Assume the user will...
Write a Pearson Module pseudocode that asks the user to enter an object’s mass in kgs,...
Write a Pearson Module pseudocode that asks the user to enter an object’s mass in kgs, and then calculate its weight. If the object weighs more than 1000 Newtons, display a message indicating that is too heavy. Otherwise display a message indicating that the object is light. Test your code in Flowgorithm. Given: Weight = Mass * 9.8 (where mass is in kilograms)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT