This is NOT homework, I have taken this class already,I am just practicing a little as this class was very difficult. Anyway I am having trouble figuring out how to develop these two functions. One needs to get the information from the user, and the other will display it. I just can't quite figure out how to compare what the utl structure variable has to what the user will input. In other words, I have to show what the over/under will be when displayed, so how do I get the average budget numbers(the utlty structure variable) to compare to what the user inputs? All I can get so far is the structure declaration its members, a constructor, two prototype functions that I will use once I figure them out, and the structure variable initialized with the average budget numbers.
Here is the program with the full instructions, and what I have currently:
Here is the program with the full instructions, and what I have currently:
// 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 declares a MonthlyBudget structure with member variables to hold
// each of these expense categories. The program should create two MonthlyBudget structure
// variables. The first will hold the budget figures given above. The second will be passed
// to a function that has the user enter the amounts actually spent in each budget category
// during the past month. The program should then pass both structure variables to a function
// 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.
#include <iostream>
using namespace std;
struct MonthlyBudget
{
double housing,
utilities,
householdExpenses,
transportation,
food,
medical,
insurance,
entertainment,
clothing,
miscellaneous;
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;