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: 500.00 Housing 150.00 Ut

ID: 3917890 • Letter: A

Question

A student has established the following monthly budget: 500.00 Housing 150.00 Utilities 65.00 Household 50.00 Expenses 50.00 Transportation 250.00 Food 30.00 Medical 100.00 Insurance 150.00 Entertainment 75.00 Clothing 50.00 Miscellaneous Write a program that has a MonthlyBudget structure designed to hold each of these expense categories. The program should pass the structure to a function that asks the user to enter the amounts spent in each budget category during a month. The program should then pass the structure to a function that displays a report indicating the amount over or under in each category, as well as the amount over or under for the entire monthly budget. NOTES: For each of the categories listed above, and in that order, the program prompts the user for the the amount spent on X: where X is a category from the above list (e.g. "Insurance"). Using the values read into the structure, the program generates a table with a heading and in each row there are four items: the category (e.g. "Housing"), followed by the value budgeted for the category (500.00 in the case of Housing), followed by the value that had been read in for that category, followed by the amount that the actual spent was over or under the category budget. Finally, after the table, is an indication of whether the student is over or under budget.

C++ Programming: I can't find a proper solution for it, so I appreciate any help, please.

Explanation / Answer

#include <iostream>

#include <string>

using namespace std;

struct MonBudget {

float housing;

float utilities;

float household;

float transportation;

float food;

float medical;

float insurance;

float entertainment;

float clothing;

float miscellaneous;

};

MonBudget setData(MonBudget);

void compare(MonBudget monbud1,MonBudget monbud2) {

    if(monbud1.housing>monbud2.housing)

      cout<<" Student spend under budget in housing expences";

    else

      cout<<" Student spend over budget in housing expences";

    if(monbud1.utilities>monbud2.utilities)

      cout<<" Student spend under budget in utilities expences";

    else

      cout<<" Student spend over budget in utilities expences";

    if(monbud1.household>monbud2.household)

      cout<<" Student spend under budget in household expences";

    else

      cout<<" Student spend over budget in household expences";

    if(monbud1.transportation>monbud2.transportation)

      cout<<" Student spend under budget in transportation expences";

    else

      cout<<" Student spend over budget in transportation expences";

    if(monbud1.food>monbud2.food)

      cout<<" Student spend under budget in food expences";

    else

      cout<<" Student spend over budget in food expences";

    if(monbud1.medical>monbud2.medical)

      cout<<" Student spend under budget in medical expences";

    else

      cout<<" Student spend over budget in medical expences";

    if(monbud1.insurance>monbud2.insurance)

      cout<<" Student spend under budget in insurance expences";

    else

      cout<<" Student spend over budget in insurance expences";

    if(monbud1.entertainment>monbud2.entertainment)

      cout<<" Student spend under budget in entertainment expences";

    else

      cout<<" Student spend over budget in entertainment expences";

    if(monbud1.clothing>monbud2.clothing)

      cout<<" Student spend under budget in clothing expences";

    else

      cout<<" Student spend over budget in clothing expences";

   if(monbud1.miscellaneous>monbud2.miscellaneous)  

      cout<<" Student spend under budget in miscellaneous expences";

    else

      cout<<" Student spend over budget in miscellaneous expences";

}

int main() {

struct MonBudget monbud1,monbud2;

monbud1.housing=500.00;

monbud1.utilities=150.00;

monbud1.household=65.00;

monbud1.transportation=50.00;

monbud1.food=250.00;

monbud1.medical=30.00;

monbud1.insurance=100.00;

monbud1.entertainment=150.00;

monbud1.clothing=75.00;

monbud1.miscellaneous=50.00;

monbud2=setData(monbud2);

compare(monbud1,monbud2);             

}

MonBudget setData(MonBudget monbud) {

cout<<" Enter the housing Expenses:";

cin>>monbud.housing;

cout<<" Enter the utilities Expenses:";

cin>>monbud.utilities;

cout<<" Enter the house hold Expenses:";

cin>>monbud.household;

cout<<" Enter the transportation Expenses:";

cin>>monbud.transportation;

cout<<" Enter the food Expenses:";

cin>>monbud.food;

cout<<" Enter the medical Expenses:";

cin>>monbud.medical;

cout<<" Enter the insurance Expenses:";

cin>>monbud.insurance;cout<<" Enter the entertainment Expenses:";

cin>>monbud.entertainment;

cout<<" Enter the clothing Expenses:";

cin>>monbud.clothing;

cout<<" Enter the miscellaneous Expenses:";

cin>>monbud.miscellaneous;

return monbud;

}

               

Sample Output:

Enter the housing Expenses: 200

Enter the utilities Expenses: 50

Enter the house hold Expenses: 50

Enter the transportation Expenses: 30

Enter the food Expenses: 150

Enter the medical Expenses: 20

Enter the insurance Expenses: 200

Enter the entertainment Expenses: 100

Enter the clothing Expenses: 50

Enter the miscellaneous Expenses: 50

Student spend under budget in housing expences

Student spend under budget in utilities expences

Student spend under budget in household expences

Student spend under budget in transportation expences

Student spend under budget in food expences

Student spend under budget in medical expences

Student spend over budget in insurance expences

Student spend under budget in entertainment expences

Student spend under budget in clothing expences

Student spend over budget in miscellaneous expences

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