Concept explainers
C
Assignment #4
Introduction to C Programming – COP 3223
Objectives
1. To learn how to use loops for repeated execution
2. To reinforce knowledge of If-Else statements for conditional execution
Introduction: Programmers for a Better Tomorrow
Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical societies, and scholarship organizations manage various tasks so that they can focus on making the world a better place! They have asked you and your classmates to help them develop some new programs to benefit their organizations.
Problem: Scholarship Endowment Fund Part 2 (fund2.c)
One division of Programmers for a Better Tomorrow is their Scholarship Endowment Fund. They provide yearly scholarships to students who need a hand in amounts of 1000, 500, and 250 dollars.
The money for these scholarships comes from interest made on previous donations and investments. You will create a program to track the amount in the Fund as various donations and investments are made. Donations are a one-time increase to the amount. Investments are listed as one-time decreases with the return on investment (ROI) being calculated at a later time. ROI is not within the scope of this assignment.
To begin the program, ask the user for the starting balance of the fund.
Then, your program should allow the user the following options:
1) Make a donation
2) Make an investment
3) Print balance of fund
4) Quit
Option 1:
Prompt the user for their donation amount. Add this amount to the balance of the fund.
Option 2:
Prompt the user for their investment amount. In order to continue to provide scholarships, the fund cannot be allowed to fall below its initial amount. If an investment would bring the fund below that value, then simply print out “You cannot make an investment of that amount.” If the amount is valid, deduct it from the balance of the fund.
Option 3:
Print the current balance of the fund, the current total number of donations, and the current total number of investments.
2
After options 1, 2, and 3 prompt the user with the menu again.
Option 4:
Print the final balance of the fund, the final total number of donations, and the final total number of investments.
Do not prompt the user for any more information.
Input Specification
1. Menu responses are guaranteed to be integers greater than zero
2. Each monetary value will be a numerical value between -20,000 and 20,000.
Output Specification
Any monetary values should be formatted to two decimal places.
Output Sample
Below is a sample output of running the program. Note that this sample is NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above.
In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for clarity’s sake.)
Sample Run #1 (
Welcome!
What is the initial balance of the fund?
15000
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
1
How much would you like to donate?
1000
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
2
How much would you like to invest?
2000
You cannot make an investment of that amount.
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
2
How much would you like to invest?
500
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
3
The current balance is $15500.00.
There have been 1 donations and 1 investments.
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
1
How much would you like to donate?
2000
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
1
How much would you like to donate?
2000
What would you like to do?
1 - Make a donation
2 - Make an investment
3 - Print balance of fund
4 - Quit
4
The final balance is $19500.00.
There were 3 donations and 1 investments.
Restrictions
Although you may use other compilers, your program must compile and run using Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include comments throughout your code describing the major steps in solving the problem.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 3 images
- C Language Title: Quests from the Queenarrow_forwardC Language thanksarrow_forwardPYTHON Q9: Assignment statements, such as x = 3, define variables in programs. To execute one in an environment diagram, record the variable name and the value: Evaluate the expression on the right side of the = sign Write the variable name and the expression's value in the current frame. Use these rules to draw a simple diagram for the assignment statements below. x = 10 % 4 y = x x **= 2arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education