I need help with this program in basic C Then your program s
I need help with this program in basic C.
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
3
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
4
The final balance is $19500.00. There were 3 donations and 1 investments
Solution
#include<stdio.h>
main()
{
double int_fund_balance,fund_balance,donation_amt,investment_amt;
int investments,donations,response,n=0;
clrscr();
printf(\"Hi, Welcome!\ Enter the initial fund balance:);
scanf(\"%f\",&int_fund_balance);
fund_balance = int_fund_balance ;
while (n=0)
{
printf(\"What would you like to do?\ 1.Make a donation 2.Make an investment 3.Print
balance of fund 4.Quit\ \");
scanf(\"%d\",&response);
if(response ==1)
{
printf(\"Please enter the donation amount\ \");
scanf(\"%f,&donation_amt);
donations = donations + 1;
fund_balance = fund_balance + donation_amt;
}
else if(response == 2)
{
printf(\"Please enter investment amount:\ \");
scanf(\"%f,&investment_amt);
if((fund_balance - investment-amt) < int_fund_balance)
{
printf(\"You cannot make an investment of that amount\ \");
}
else
{
fund_balance = fundbalance - investment-amt;
investments = investments + 1;
}
}
else if(response == 3)
{
printf(\"Current fund balance is %f\ \",fund_balance);
printf(\"Number of investments made is %d\ \",investments);
printf(\"Number of donation made is %d\ \",donations);
}
else if(response==4)
{
break;
}
else
continue;
}
}

