#include #include #include using namespace std; struct MonthlyBudget { double housing; double utilities; double household; double transportation; double food; double medical; double insurance; double entertainment; double clothing; double miscellanous; }; void getSpending(MonthlyBudget&); void computeSpending(MonthlyBudget); int main() { MonthlyBudget march2017; getSpending(march2017); computeSpending(march2017); return 0; } void getSpending(MonthlyBudget &m) { cout << "Enter your housing cost for the month: "; cin >> m.housing; cout << endl; cout << "Enter your utilities cost for the month: "; cin >> m.utilities; cout << endl; cout << "Enter your household cost for the month: "; cin >> m.household; cout << endl; cout << "Enter your transportation cost for the month: "; cin >> m.transportation; cout << endl; cout << "Enter your food cost for the month: "; cin >> m.food; cout << endl; cout << "Enter your medicine cost for the month: "; cin >> m.medical; cout << endl; cout << "Enter your insurance cost for the month: "; cin >> m.insurance; cout << endl; cout << "Enter your entertainment cost for the month: "; cin >> m.entertainment; cout << endl; cout << "Enter your clothing cost for the month: "; cin >> m.clothing; cout << endl; cout << "Enter your housing miscellanous for the month: "; cin >> m.miscellanous; cout << endl; } void computeSpending(MonthlyBudget m) { cout << fixed << showpoint << setprecision(2); if(m.housing > 500) cout << "You overspent housing by $" << m.housing - 500 << endl; else if (m.housing == 500) cout << "You spent to your housing limit." << endl; else cout << "You underspent housing by " << 500 - m.housing << " and saved that amount." << endl; if(m.utilities > 150) cout << "You overspent utilities by $" << m.utilities - 150 << endl; else if (m.utilities == 150) cout << "You spent to our utilities limit." << endl; else cout << "You underspent utilities by " << 150 - m.utilities << " and saved that amount." << endl; if(m.household > 65) cout << "You overspent household expenses by $" << m.household - 65 << endl; else if (m.household == 65) cout << "You spent to your household expenses limit." << endl; else cout << "You underspent household expenses by " << 65 - m.household << " and saved that amount." << endl; if(m.transportation > 50) cout << "You overspent transportation by $" << m.transportation - 50 << endl; else if (m.transportation == 50) cout << "You spent to your transportation limit." << endl; else cout << "You underspent transportation by " << 50 -m.transportation << " and saved that amount." << endl; if(m.food > 250) cout << "You overspent food by $" << m.food - 250 << endl; else if (m.food == 250) cout << "You spent to your food limit." << endl; else cout << "You underspent food by " << 250 - m.food << " and saved that amount." << endl; if(m.medical > 30) cout << "You overspent medical by $" << m.medical - 30 << endl; else if (m.medical == 30) cout << "You spent to your medical limit." << endl; else cout << "You underspent medical by " << 500 - m.medical << " and saved that amount." << endl; if(m.insurance > 100) cout << "You overspent insurance by $" << m.insurance - 100 << endl; else if (m.insurance == 100) cout << "You spent to your insurance limit." << endl; else cout << "You underspent insurance by " << 100 - m.insurance << " and saved that amount." << endl; if(m.entertainment > 150) cout << "You overspent entertainment by $" << m.entertainment - 150 << endl; else if (m.entertainment == 150) cout << "You spent to your entertainment limit." << endl; else cout << "You underspent entertainment by " << 150 - m.entertainment << " and saved that amount." << endl; if(m.clothing > 75) cout << "You overspent clothing by $" << m.clothing - 75 << endl; else if (m.clothing == 75) cout << "You spent to your clothing limit." << endl; else cout << "You underspent clothing by " << 75 - m.clothing << " and saved that amount." << endl; if(m.miscellanous > 50) cout << "You overspent miscellanous by $" << m.miscellanous - 50 << endl; else if (m.miscellanous == 50) cout << "You spent to your miscellanous limit." << endl; else cout << "You underspent miscellanous by " << 50 - m.miscellanous << " and saved that amount." << endl; cout << endl; cout << "Summary" << endl; cout << "Category\t\tBudget\t\tSpend\t\tDiffence" << endl; cout << "Housingg\t\t" << 500 << "\t\t" << m.housing << "\t\t" << 500 - m.housing << endl; cout << "Utilites\t\t" << 150 << "\t\t" << m.utilities << "\t\t" << 150 - m.utilities << endl; cout << "Household Expenses\t" << 65 << "\t\t" << m.household << "\t\t" << 65 - m.household << endl; cout << "Transportation\t\t" << 50 << "\t\t" << m.transportation << "\t\t" << 50 - m.transportation << endl; cout << "Food\t\t\t" << 250 << "\t\t" << m.food << "\t\t" << 250 - m.food << endl; cout << "Medical\t\t\t" << 30 << "\t\t" << m.medical << "\t\t" << 30 - m.medical << endl; cout << "Insurance\t\t" << 100 << "\t\t" << m.insurance << "\t\t" << 100 - m.insurance << endl; cout << "Entertainment\t\t" << 150 << "\t\t" << m.entertainment << "\t\t" << 150 - m.entertainment << endl; cout << "Clothing\t\t" << 75 << "\t\t" << m.clothing << "\t\t" << 75 - m.clothing<< endl; cout << "Miscellanous\t\t" << 50 << "\t\t" << m.miscellanous << "\t\t" << 50 - m.miscellanous << endl; cout << endl; double SumBudget; double SumSpending; double SumNet; SumBudget = 500 + 150 + 65 + 50 + 250 + 30 + 100 + 150 + 75 + 50; SumSpending = m.housing + m.utilities + m.household + m.transportation + m.food + m.medical + m.insurance + m.entertainment + m.clothing + m.miscellanous; SumNet = SumBudget - SumSpending; cout << "Total Budget for the Month:\t $" << SumBudget << endl; cout << "Total Spend for the Month:\t $" << SumSpending << endl; cout << "Net Difference for the Month:\t $" << SumNet << endl; }