Problem Statement: File Handling in C/C++
On the basis of the given scenario create a file Expenses.txt, Open the file and copy into another Expenses2.txt, Also show output on screen
A college has announced the total budget of 50,000Rs.for each game. Games are done four times in a year. Take expenses as an input from user.
Calculate the average expenses for a game:

1. If the expenses greater than 80% show as” Very Expensive”.
2. If the expenses are greater than 60% and less than 80% than show “Expensive ”
3. If the expenses are greater than 50% and less than 60% than show “Less Expensive ”
4. If the expenses are greater than 40% and less than 50% than show “Not Costly”.
5. If the expenses are less than 40% than show “Best”.

You need a class named Expense.

Open the file (expenses1)

Read in the expense values, token-by-token (line-by-line, number-by-number, etc....however they are broken up), storing each value in a double (maybe indexes 0, 1, 2 and 3 of a double[4] array?)

Close the file

Open a new file (expenses2)

Write each of the values from your double array to the file

Close the file

Take the sum of the expenses for each of the four games, divide it by four and store it in another double, avgExpense.

Compare avgExpense to the budget allowed for each game, 50000, and figure out into which category it falls and output the results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.