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...
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)
Write a program that asks the user to enter the name of a file, and then...
Write a program that asks the user to enter the name of a file, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the file. Use Notepad or another text editor to create a sample file that can be used to test the program. Sample Run java FileLetterCounter Enter file name: wc4↵ Enter character to count: 0↵ The character '0' appears in the file...
Program should be written in Java a) Write a program that asks the user to enter...
Program should be written in Java a) Write a program that asks the user to enter the approximate current population of India. You should have the computer output a prompt and then YOU (as the user should enter the population.)  For testing purposes you may use the value of 1,382,000,000 from August 2020. Assume that the growth rate is 1.1% per year. Predict and print the predicted population for 2021 and 2022. The printout should include the year and the estimated...
Write a Java program that asks the user to enter an integer that is used to...
Write a Java program that asks the user to enter an integer that is used to set a limit that will generate the following four patterns of multiples of five using nested loops •Ascending multiples of five with ascending length triangle •Ascending multiples of five with descending length (inverted) triangle •Descending multiples of five with ascending length triangle •Descending multiples of five with descending length (inverted) triangle Use error checking to keep asking the user for a positive number until...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT