Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A student has established the following monthly budget: Write a program that dec

ID: 3540027 • Letter: A

Question

A student has established the following monthly budget:

Write a program that declares a MonthlyBudget structure with member variables to hold each of these expense categories. The program should create two MonthlyBudget structure variables. The first MonthlyBudget structure variable will hold (ie., be assigned) the budget figures given above. Pass this first structure variable to a function displayBudget that will display the budget categories along with the budgeted amounts.

The second MonthlyBudget structure variable will be passed to another function getExpenses that has the user enter the amounts actually spent in each budget category during the past month. Finally, the program should then pass both structure variables to a function called compareExpenses that displays a report indicating the amount over or under budget the student spent in each category, as well as the amount over or under for the entire monthly budget.

You may design your own user-input interface but you must use a structure. The format of the monthly budgeted report should appear as similar as possible to the sample output shown below. HINT: Use the setw and right manipulators (Gaddis 7EO, Chapter 3) to right-justify dollar value outputs.

Budget Categories Budgeted amount Housing $ 500.00 Utilities $ 150.00 Household Expenses $ 65.00 Transportation $ 50.00 Food $ 250.00 Medical $ 30.00 Insurance $ 100.00 Entertainment $ 150.00 Clothing $ 75.00 Miscellaneous $ 50.00 *(DO NOT use arrays, pointers or an array of structs)

Explanation / Answer

#include <iostream>


using namespace std;


struct MonthlyBudget


{

    double housing,

          utilities,

           householdExpenses,


           transportation,

           food,


           medical,


           insurance,


           entertainment,


           clothing,

           miscellaneous;


38

    MonthlyBudget(double h= 0, double u= 0, double he = 0, double t= 0, double f= 0,double m= 0, double i= 0, double e= 0, double c= 0, double misc= 0)


    {


        housing = h;


        utilities = u;


        householdExpenses = he;


        transportation = t;


        food = f;


        medical = m;


        insurance = i;

       entertainment = e;


        clothing = c;


        miscellaneous = misc;


    }


     


};



MonthlyBudget getAmount();

MonthlyBudget displayAmount();



int main()

{

    MonthlyBudget utlty(500.00, 150.00, 65.00, 50.00, 250.00, 30.00, 100.00, 150.00, 75.00, 50.00);

    double budget;

#include <iostream>

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote