Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

c++ image text in transcribed
image text in transcribed
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. 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 Il declare A as an array of 7 expenditure objects F1, F2, F3, F4, F5, F6, F7 with default values 1/ print the name and subTotal of each family // print the count and totalExpenditures. 1/ read from the text file expenditure.txt the following data assuming that the number of lines is not known Al-Mullah 700 2800 1600 800 3100 1400 Al-Roome 650 3007 1800 Al-Shebani 910 2140 1100 540 2440 1900 1200 Al-Walled 940 1700 Il print the count and totalExpenditures Al-Issa Al-Kurdi Al-Ali 720 2800 1300 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: 3100 Total number of families is: 0 and total expenditure is: 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions