Question: Please help i'm lost on this project: Budget Analysis Write a program so that the monthly budget and the indefinite list of expenses is input

Please help i'm lost on this project:

Budget Analysis

Write a program so that the monthly budget and the indefinite list of expenses is input from a data file. The following is a reasonable design for the data text file named expenses.txt, but you are welcome to organize it another way. No spaces are needed between each line, it just pasted that way.

January 2017

1616

Car payment

309

Rent

652

Insurance

200

Supermarkets_food

500

Restaurants

150

Internet_service

56

Cell_phone

109

Gasoline

175

Program Specifications:

Data is input from a file.

The list of expenses data is stored in parallel arrays (or vectors).

The expenses data includes the descriptive label (e.g., Car payment) and the expense amount (e.g., 309).

The months budget amount is displayed.

The input expenses data is output in a tabular format showing the list of expense labels and amounts.

The sum of the expenses is computed and output.

An appropriate comment is displayed comparing the month's expenses to the budgeted.

The largest and smallest budgeted expense are displayed.

Should input this:

 Please help i'm lost on this project: Budget Analysis Write a

I have this but it shows up $0 for me

#include #include #include

#define MAX 1000

using namespace std;

int main()

{ ifstream infile; char name[MAX],item[MAX][MAX]; float dollar,budget,sum = 0; int count = 0; float price[MAX];

infile.open("expenses.txt"); if (!infile.is_open()) { cerr

while(infile.getline(name,MAX)) { strcpy(item[count],name); infile.getline(name,MAX); price[count] = atof(name); sum += atof(name);

coutbudget) cout

int i,max_i = 0,min_i = 0; for(i=1;iprice[max_i]) max_i = i;

for(i=1;i

cout

return 0; }

Budget for the month of January 2017: $1616.00 Expenses Amounts 309.00 Car payment 652.00 Rent 200.00 Insurance Supermarkets food 500.00 150.00 Restaurants 56.00 Internet service Cell phone 109.00 Gasoline 175.00 $2151.00 Sum of expenses Careful, you've exceeded your budget by $535.00 dollars Largest budgeted item: $652.00 for Rent Smallest budgeted item: $56.00 for Internet service

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!