Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3A: Designing and implementing a C++ structure data type: Monthly Budget A student has established the following monthly budget: Budget Categories Budgeted amount Housing

Project 3A: Designing and implementing a C++ structure data type: Monthly Budget

A student has established the following monthly budget:

Budget Categories Budgeted amount
Housing $ 580.00
Utilities $ 150.00
Household Expenses $ 65.00
Transportation $ 50.00
Food $ 250.00
Medical $ 30.00
Insurance $ 100.00
Entertainment $ 150.00
Clothing $ 75.00
Miscellaneous $ 50.00
*(DO NOT use arrays, pointers or an array of structs)

Write a program that declares a MonthlyBudget structure designed with member variables to hold each of these expense categories. The program should define two MonthlyBudget structure variables budgetand spent. The first MonthlyBudget structure variable budget will contain (ie., be assigned) the budget figures given above. Pass this first structure budget variable to a function displayBudget that will display the budget categories along with the budgeted amounts.

The second MonthlyBudget structure variable spent will be passed to another function getExpenses that has the user enter the amounts actually spent in each budget category during the past month. Finally, the program should then pass both structure variables budget and spent to a function compareExpenses that displays a report indicating the amount over or under budget the student spent in each category, as well as the amount over or under for the entire monthly budget.

You may design your own user-input interface but you must use a structure and must implement the three functions listed above. The format of the monthly budgeted report should appear as similar as possible to the sample output shown below.

HINT: Use the setw and right manipulators (Gaddis 7EO, Chapter 3) to right-justify dollar value outputs in function compareExpenses.

INPUT VALIDATION: Do not accept negative values for the users actual expenditure inputs in function getExpenses.

A sample test run using the Code::Block IDE-Compiler
Here is your monthly budget: Housing $ 580 Utilities $ 150 Household $ 65 Transportation $ 50 Food $ 250 Medical $ 30 Insurance $ 100 Entertainment $ 150 Clothing $ 75 Miscellaneous $ 50 ================================================= Total Budgeted $ 1500 ================================================= Enter actual monthly expenditures for each budget category Housing: $ 580 Utilities: $ 130 Household: $ 50 Transportation:$ 50 Food: $ 230 Medical: $ 30 Insurance: $ 100 Entertainment: $ 120 Clothing: $ -10 ERROR: You must enter a positive number. Clothing: $ 100 Miscellaneous: $ 30 Budgeted Spent Difference ================================================= Housing 580.00 580.00 0.00 Utilities 150.00 130.00 -20.00 Household 65.00 50.00 -15.00 Transportation 50.00 50.00 0.00 Food 250.00 230.00 -20.00 Medical 30.00 30.00 0.00 Insurance 100.00 100.00 0.00 Entertainment 150.00 120.00 -30.00 Clothing 75.00 100.00 25.00 Miscellaneous 50.00 30.00 -20.00 ================================================= Total 1500.00 1420.00 80.00 ================================================= Congratulations! You were $80.00 under budget this month. Process returned 0 (0x0) execution time : 104.850 s Press any key to continue. 

Please make sure to include appropriate function documentation as needed (see handout on Function Documentation: Assertions and Dataflow comments) and separate your functions with at least 1/2 inch of whitespace. You may use parameterized constructors for the initial budget amounts and constant reference parameters when passing the structure variables to the functions mentioned above (refer to struct related source code samples: struct1b.cpp, struct3a.cpp and struct3b.cpp). DO NOT use global variables. Prior to submitting your completed source code, make sure your test-run output is similar to sample outputs provided. Submit your "source code" to the programming challenge above Turn in your source code by saving it as a .cpp file and attaching it to the file upload submission area.

4 points per correct function name/procedures for the following: (1) displayBudget (2) getExpenses (3) compareExpenses. Appropriate input validation routine must be included during user input of actual expenditures.

MonthlyBudget structure declared with appropriate members and two struct variables of type MonthlyBudget defined

Program shows correct output, properly formatted when it is compiled/run with sample data similar to the output shown

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago