Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C Programming Assignment: Write a C program that allows the user to make some si

ID: 3624993 • Letter: C

Question

C Programming Assignment:

Write a C program that allows the user to make some simple banking transactions. The program should first prompt the user to enter the current balance of his/her bank account (in dollars and cents, not less than zero). The program should then prompt the user to enter the number of withdrawals to make, and then the number of deposits to make. For this assignment, set a maximum of 50 deposits and 50 withdrawals.

Using a loop, the program should then prompt the user to enter the amount of the first deposit (a positive amount to add to the bank account balance), the amount of the second deposit, the third, & etc., until the number of deposits have been processed.

Using a second loop, the program should then prompt the user to enter the amount of the first withdrawal (a positive amount to subtract from the bank account balance, if possible), the amount of the second withdrawal, the third, & , etc. until the number of withdrawals have been processed. Once all deposits and withdrawals have been made, the program should output the ending balance.

Read all the specifications carefully. We did not show all of the editing features required.

The dialog with the user should look similar to the following, only with a special introductory statement(s) as desired:



Welcome to the Third Centry Banking System

Please enter your first name: Belal

Hello Belal.

Now enter your current balance in dollars and cents: 256.40

Enter the number of withdrawals: 2

Enter the number of deposits : 3

Enter the amount of deposit #1: 10.50
Enter the amount of deposit #2: 12.25
Enter the amount of deposit #3: 125.30

Enter the amount of withdrawal #1: 120.35
Enter the amount of withdrawal #2: 35.60

*** The closing balance Belal is $248.50 ***

At this point, the program should also output one of the following messages based on the closing balance. That is:

If the closing balance is greater than or equal to 50000.00, output:
"*** (name) it is time to invest some money. ***"

If the closing balance is between 15000.00 and 49999.99, output:
"*** (name) you should consider a CD. ***"

If the closing balance is between 1000.00 and 14999.99, output:
"*** (name) keep up the good work. ***"

If the closing balance is between 0.00 and 999.99, output:
"*** (name) your balance is getting low. ***"



So, in the above example, the last line of sample output would be:

*** Belal your balance is getting low! ***

Regarding error checking on all user input, the following check should be made while users are entering the withdrawal amounts: If the withdrawal amount exceeds the current balance (including the new deposits), the program should issue the following error message:

*** Withdrawal amount exceeds current balance. ***

The program should then re-prompt for a lower withdrawal amount. But, if the current balance goes to zero, no more withdrawals should be made and an appropriate custom message should appear.



For example, a sample run of the program with error checking might look like:



Enter current balance in dollars and cents: -56.40
Error: Beginning balance must be at least zero, please re-enter.

Enter current balance in dollars and cents: 256.40


Enter the number of withdrawals: 2

Enter the number of deposits: -3
Error: Number of deposits must be at least zero, please re-enter.

Enter the number of deposits: 3


Enter the amount of deposit #1: 10.50
Enter the amount of deposit #2: 12.25
Enter the amount of deposit #3: 125.30

Enter the amount of withdrawal #1: 5000.00
*** Withdrawal amount exceeds current balance. ***
Enter the amount of withdrawal #1: 120.35
Enter the amount of withdrawal #2: 35.60

*** The closing balance Jim is $248.50 ***
*** Belal your balance is getting low. ***

Keep track of all of the deposits and all of the withdrawals so that you can print them out in "record" form. Do this by storing them in arrays. You will have one array to hold the deposit amounts entered by the user, and another array to hold the withdrawal amounts. Make sure that the size of the arrays are large enough to handle 50 deposits and 50 withdrawals. Example:

float deposits[50], withdrawals[50];

*** Bank Record ***
Starting Balance: $ 256.40

Deposit #1: 10.50
Deposit #2: 12.25
Deposit #3: 125.30

Withdrawal #1: 120.35
Withdrawal #2: 35.60

Ending Balance: $ 248.50


Align the decimal points in the bank record.


Notice the test above for "Too many deposits". Be sure that the user does not want to enter more information than you can store in your array. In the example above, the array sizes are "50". That means that it can store up to 50 deposits and 50 withdrawals. Test that the user does not plan to enter more than that. The same error checking should be done on the code that prompts for withdrawals.

Explanation / Answer

Ok so basically what you want to do here is set up a variable to store the name, balance, ,total, # of withdrawls and # of deposits. -So then create the general greeting -Make a prompt asking for the name -Make a prompt asking for the initial balance -Check to make sure the initial balance is NOT less than zero using a WHILE LOOP. -Prompt the user for the number of withdrawals -Check to see if the number of withdrawals is greater than or equal 0 and less than or equal to 50 if not prompt again -Prompt the user for the number of deposits -Check to see if number of deposits is greater or equal to 0 and less than or equal to 50, if not prompt again -Set up a for loop prompting for the number of deposits [ie: for(int i = 0; i