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) о i псome (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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

i would like to get the same output as the question, can help me using c prog

d) In the display(...) function:
Open with
Using a do-while loop (repeat for 3 times):
Display allocated amount for necessity, invest, play and charity
individuals.
Sample output:
Automated Money Management System
Enter your name
Enter your age
Enter your monthly nett income : RM 59es
: Chan
: 39
Enter your name
Enter your age
Enter your monthly nett income
: Ching
: 44
: RM 7706
Enter your name
Enter your age
Enter your monthly net
: Cindy
: 47
: RM 9001
income
Chan, your salary should be allocated as follows:
[1] Necessity Account
[2] Invest Account
[3] Play Account
[4] Charity Account
: RM 3840.20
: RM 1181.6e
: RM 590.80
: RM 295.40
Ching, your salary should be allocated as follows:
[1] Necessity Account
[2] Invest Account
[3] Play Account
[4] Charity Account
: RM see8.9e
: RM 154120
: RM 770.60
: RM 385.30
Cindy, your salary should be allocated as follows:
[1] Necessity Account
[2] Invest Account
[3] Play Account
[4] Charity Account
: RM 5850.65
: RM 1800, 20
: RM 90e.10
: RM 450.es
File Report.txt before (top) and after (bottom) execution:
|Report - Notepad
File Edit Format View Help
Benji
Belinda 27
21
2257.00 1467.05 451.40
225.70
112.85
3577.00 2325.05 715.40
357.70 178.85
Report - Notepad
File Edit Format View Help
Benji
Belinda 27
21
2257.00 1467.05 451.40
225.70
112.85
3577.00 2325.05 715.40
357.70
178.85
5908.00 3840.20 1181.60 590.80
Chan
Ching
Cindy
39
295.40
385.30
+.05
44
7796.00 5008.90 1541.20 770.60
47
900 Page 5860.ds
6 00.20 900
Transcribed Image Text:d) In the display(...) function: Open with Using a do-while loop (repeat for 3 times): Display allocated amount for necessity, invest, play and charity individuals. Sample output: Automated Money Management System Enter your name Enter your age Enter your monthly nett income : RM 59es : Chan : 39 Enter your name Enter your age Enter your monthly nett income : Ching : 44 : RM 7706 Enter your name Enter your age Enter your monthly net : Cindy : 47 : RM 9001 income Chan, your salary should be allocated as follows: [1] Necessity Account [2] Invest Account [3] Play Account [4] Charity Account : RM 3840.20 : RM 1181.6e : RM 590.80 : RM 295.40 Ching, your salary should be allocated as follows: [1] Necessity Account [2] Invest Account [3] Play Account [4] Charity Account : RM see8.9e : RM 154120 : RM 770.60 : RM 385.30 Cindy, your salary should be allocated as follows: [1] Necessity Account [2] Invest Account [3] Play Account [4] Charity Account : RM 5850.65 : RM 1800, 20 : RM 90e.10 : RM 450.es File Report.txt before (top) and after (bottom) execution: |Report - Notepad File Edit Format View Help Benji Belinda 27 21 2257.00 1467.05 451.40 225.70 112.85 3577.00 2325.05 715.40 357.70 178.85 Report - Notepad File Edit Format View Help Benji Belinda 27 21 2257.00 1467.05 451.40 225.70 112.85 3577.00 2325.05 715.40 357.70 178.85 5908.00 3840.20 1181.60 590.80 Chan Ching Cindy 39 295.40 385.30 +.05 44 7796.00 5008.90 1541.20 770.60 47 900 Page 5860.ds 6 00.20 900
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
Transcribed Image 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY