Question: hi, i want the program written in c++ ---------------------------------------------- We would like to develop class expenditure to be used to find the total expenditures for

hi, i want the program written in c++

----------------------------------------------

We would like to develop class expenditure to be used to find the total expenditures for a number of families. The class has data members name (of type string), the data members of type int: utilities, food, personal, subTotal, static data members count (to keep track of the total number of family objects instantiated from class expenditure), and totalExpenditure (to keep track of the total expenditures of all families represented by all declared objects). The class expenditure also has any needed set and get member functions, a parameterized constructor with default values "Al-Mullah", 800, 2400, and 1200. A destructor, and a print( ) function to write all the details of an expenditure object. The class has a member function getCount( ) to return count, a member function getTotalExpenditures( ) to return total expenditures. The destructor should print the values of count and totalExpenditure.

  • Write the definition of the class expenditure in the file expenditure.h
  • Implement the member functions of the class in the file expenditureImp.cpp.
  • Write a test driver main( ) in the file expenditure.cpp that does the following

// declare A as an array of 7 expenditure objects F1, F2, F3, F4, F5, F6, F7 with default values

// print the name and subTotal of each family

// print the count and totalExpenditures

// read from the text file expenditure.txt the following data assuming that the number of lines is not known

Al-Mullah 700 2800 1600

Al-Issa 800 3100 1400

Al-Roome 650 3007 1800

Al-Shebani 910 2140 1100

Al-Kurdi 540 2440 1900

Al-Ali 720 2800 1200

Al-Walled 940 1700 1300

// print the count and totalExpenditures

Use const whenever needed to enforce the principle of least privilege.

Sample Output might look like the following:

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Al-Mullah expenditure is: 4400

Number of families is: 7 and total expenditure is: 30800

Al-Mullah expenditure is: 5100

Al-Issa expenditure is: 5300

Al-Roome expenditure is: 5457

Al-Shebani expenditure is: 4150

Al-Kurdi expenditure is: 4880

Al-Ali expenditure is: 4720

Al-Walled expenditure is: 3940

Number of families is: 7 and total expenditure is: 33547

Total number of families is: 6 and total expenditure is: 29607

Total number of families is: 5 and total expenditure is: 24887

Total number of families is: 4 and total expenditure is: 20007

Total number of families is: 3 and total expenditure is: 15857

Total number of families is: 2 and total expenditure is: 10400

Total number of families is: 1 and total expenditure is: 5100

Total number of families is: 0 and total expenditure is: 0

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!