This needs to be done in C++ please. Design a program that asks the user to ente
ID: 3678267 • Letter: T
Question
This needs to be done in C++ please.
Design a program that asks the user to enter the amount that he or she has budgeted for a month along with an indefinite input loop for the month’s expenses. The expenses input loop should accumulate the total of the expenses. When the expenses input loop finishes, the program should display an appropriate message comparing the month’s expenses to the budget. It has to have this input Monthly Budget of $1855.00
Expenses: ------------------------------
Car payment $201.00
Rent: $950.00
Insurance: $200.00
Supermarkets, food: $400.00
Restaurants: $100.00
Internet service: $56.00
Cell phone: $109.00
Gasoline: $175.00
Explanation / Answer
Program to compare the total monthly expences with the budget.
#include<iostream>
using namespace std;
int main()
{
char c;double budget;
double car;
double rent;
double insu;
double supfood=;
double restau;
double internet;
double cell;
double gas;
double total;
double remb;
double deficit;
while(true)
{
cout << "Input Mothly Budget $:";
cin >> budget;
System.out.println("-----------------------");
cout << "Car payment $:";
cin >> car;
cout << "Rent $:";
cin >> rent;
cout << "Insurance $:";
cin >> insu;
cout << "Supermarkets, food $:";
cin >> supfood;
cout << "Restaurants $: ";
cin >> restau;
cout << "Internet service $: ";
cin >> internet;
cout << "Cell phone $: ";
cin >> cell;
cout << "Gasoline $: ";
cin >> gas;
total=car+rent+insu+supfood+restau+internet+cell+gas;
cout << "Total Expences for this month is :"+total+" $";
if(budget>total)
{
remb=budget-total;
cout << "Your have budget amount still remained :"+remb+" $";
}
else
{ deficit=total-budget;
cout << " ";
cout << "You Expences exceded you budget by:"+deficit+" $");}
cout << "Do you want to continue(Y/N) :";
cin >> c;
if(c=='Y' || c=='y')
continue;
else
break;
}
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.