C++ Program Structured data Monthly Budget A student has established the followi
ID: 3632346 • Letter: C
Question
C++ Program
Structured data
Monthly Budget
A student has established the following monthly budget:
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
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 ask 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.
Explanation / Answer
#include #include using namespace std; struct MonthlyBudget { int house; int util; int he; int trans; int food; int med; int ins; int ent; int cloth; int misc; int gross; }; void getSpentBudget(MonthlyBudget &spent) { cout > spent.house; cout > spent.util; cout > spent.he; cout > spent.trans; cout > spent.food; cout > spent.med; cout > spent.ins; cout > spent.ent; cout > spent.cloth; cout > spent.misc; } void reportBudget(MonthlyBudget spent, MonthlyBudget actual) { //Calculate the student's expenditures for the month spent.gross = spent.house + spent.util + spent.he + spent.trans + spent.food + spent.med + spent.ins + spent.ent + spent.cloth + spent.misc; coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.