Write a program that assists the user to determine a simple budget based on the income entered. Using the system, the income would be divided into four different categories; Necessity: Typical...


hi i would you to help me with this question


Write a program that assists the user to determine a simple budget based on the income<br>entered. Using the system, the income would be divided into four different categories;<br>Necessity: Typical expenses such as rent, transport, utilities, insurance, etc.<br>Invest: Investment opportunity in real estate, stock market, etc.<br>Play: Amount that can be spent on small luxury such as fine dining, gadget, etc.<br>Charity: Contribution to help other less fortunate person or charitable organization.<br>a) Create a structure called Budget. The attributes in the structure are:<br>o name (string)<br>o age (int)<br>o income (float)<br>o necessity (float)<br>o play (float)<br>o invest (float)<br>o charity (float)<br>Declare a structure variable array called info with size 3.<br>b) In main() function:<br>Create a FILE pointer called fp. Use this pointer to open the file Report.txt for<br>updating. The file contains the name, age, income, necessity, play, invest, charity.<br>• If the file cannot be opened, display error message

Extracted text: Write a program that assists the user to determine a simple budget based on the income entered. Using the system, the income would be divided into four different categories; Necessity: Typical expenses such as rent, transport, utilities, insurance, etc. Invest: Investment opportunity in real estate, stock market, etc. Play: Amount that can be spent on small luxury such as fine dining, gadget, etc. Charity: Contribution to help other less fortunate person or charitable organization. a) Create a structure called Budget. The attributes in the structure are: o name (string) o age (int) o income (float) o necessity (float) o play (float) o invest (float) o charity (float) Declare a structure variable array called info with size 3. b) In main() function: Create a FILE pointer called fp. Use this pointer to open the file Report.txt for updating. The file contains the name, age, income, necessity, play, invest, charity. • If the file cannot be opened, display error message "File cannot be opened. Terminating..." and quit the program. Call function get_details(...), passing info as argument. Using a for..loop (repeat for 3 times): Write the name, age, income, necessity, invest, play and charity into file report.txt. Call function display(...), passing info as argument. Close file Report.txt. c) In the get details(...) function: Using a while.loop (repeat for 3 times): Request from the user to enter data for name, age and income for each individual. Calculate the allocation amount according to the following table. Category necessity 65% of income invest Allocation 20% of income play charity 10% of income 5% of income
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here