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

You will write a program that will simulate the management of moncy in 3 account

ID: 3737563 • Letter: Y

Question

You will write a program that will simulate the management of moncy in 3 accounts: checking, savings, and credit General Requirements: A preprocessor directive must be used to define a MAXCREDIT of-4500 DO NOT declare any pointers for this assignment DO NOT use global variables DO NOT use break statements to stop loops . Use function prototypes. Write comments for each function before each prototype and again before each function definition. . Be sure to comment your code adequately . Be sure to indent properly. Check the course textbook and lecture code examples to see how it should be done. . Use meaningful variable names. .NOTE: To transfer between accounts, you need to make a withdraw followed by a deposit Your starting bank balances should be as follows: o Cheeking: 480.45 o Savings: o Credit: 124.62 -2134.78 You must have at least 6 user defined functions as follows: o No modifications may be made to the functions #defineCRTSECURENO WARNINGS #include stdio.h> #define MAXCREDIT -4see - - - // Displays the list of options available //prompts for the user's selection and sets the value of the selection void RunBankChoices(int choice); //greets the user void Greeting) //Takes one double argument and one character argument //displays the current balance of the account (C checking S savings, R credit) void AccountBalance(double account, char letter); //takes reference to all the bank account money values and the menu selection //Makes the decsion of which trnsaction should be done void TransactionDecision(int num, double "cPtr, double sPtr, double *rPtr); //takes a reference to the selected account balance //gets the added amount from the user and adds it to the account void DepositMoney (double accountPtr); //takes a reference to the selected account balance //gets the withdrawal amount from the user //checks to see if there is enough money available OR enough credit available //subtracts the money from the account if available void WithdrawMoney(double accountPtr, char letter);

Explanation / Answer

ANS:-

Given that,

   3 accounts: checking, savings, and credit General Requirements: A preprocessor directive must be used to define a MAXCREDIT of-4500 DO NOT declare any pointers for this assignment DO NOT use global variables DO NOT use break statements to stop loops . Use function prototypes. Write comments for each function before each prototype and again before each function definition.

PROGRAM:-

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#define MAXCREDIT -4500

//Displays the list of options available
//prints the user's selection and sets the value of selection
void RunBankChoices(int *choice);

//greets the user
void Greeting();

//takes the one double argument and one character argument
//displays the current balance of the account ('C' checking, 'S' savings, 'R' credit)
void AccountBalance(double account, char letter);

//takes reference to all the bank account money values and the menu selection
//makes the decion of which transaction should be done
void TransactionDecision(int num, double *cPtr, double *sPtr, double *rPtr);

//takes a reference to the selected account balance
//gets the added amount from user and adds it to the account
void DepositMoney(double *accountPtr);

//takes a reference to the selected account balance
//gets the withdrawal amount from the user
//checks to see if there is enough money available OR enough credit available
//substracts the money from the account if available
void WithdrawMoney(double *accountPtr, char letter);

//Displays the list of options available
//prints the user's selection and sets the value of selection
void RunBankChoices(int *choice)
{
   int c;
   printf(" --------------------------------------------- ");
   printf("(1) to DEPOSIT to CHECKING (2) to WITHDRAW from CHECKING (3) to DEPOSIT to SAVINGS (4) to WITHDRAW from SAVINGS (5) to DEPOSIT to CREDIT (6) to TAKE an ADVANCE from CREDIT (7) for all ACCOUNT BALANCES (-1) QUIT");
   printf(" Enter your choice: ");
   scanf("%d",&c);
   *choice=c;
}

//greets the user
void Greeting()
{
   printf("*************************************");
   printf(" Welcome to the Bank of COP 2220");
   printf(" It is a pleasure to manage your checking, savings, and credit accounts");
}

//takes the one double argument and one character argument
//displays the current balance of the account ('C' checking, 'S' savings, 'R' credit)
void AccountBalance(double account, char letter)
{
   if (letter=='C')
   {
       printf(" --You currently have %lf in your checking account",account);
   }
   else if (letter=='S')
   {
       printf(" --You currently have %lf in your savings account",account);
   }
   else
   {
       printf(" --You currently have %lf in your credit account",account);
   }
}

//takes reference to all the bank account money values and the menu selection
//makes the decion of which transaction should be done
void TransactionDecision(int num, double *cPtr, double *sPtr, double *rPtr)
{
   if (num==1)
   {
       DepositMoney(cPtr);
       printf(" Money Deposited..!");
   }
   else if (num==2)
   {
       WithdrawMoney(cPtr, 'C');
       printf(" Money Debited..!");
   }
   else if (num==3)
   {
       DepositMoney(sPtr);
       printf(" Money Deposited..!");
   }
   else if (num==4)
   {
       WithdrawMoney(sPtr, 'S');
       printf(" Money Debited..!");
   }
   else if (num==5)
   {
       DepositMoney(rPtr);
       printf(" Money Deposited..!");
   }
   else if (num==6)
   {
       WithdrawMoney(rPtr, 'R');
       printf(" Money Debited..!");
   }
   else if (num==7)
   {
       AccountBalance(*cPtr, 'C');
       AccountBalance(*sPtr, 'S');
       AccountBalance(*rPtr, 'R');
   }
   else
       exit(0);
}

//takes a reference to the selected account balance
//gets the added amount from user and adds it to the account
void DepositMoney(double *accountPtr)
{
   double money;
   printf("Amount to deposit: ");
   scanf("%lf",&money);
   *accountPtr=*accountPtr+money;
}

//takes a reference to the selected account balance
//gets the withdrawal amount from the user
//checks to see if there is enough money available OR enough credit available
//substracts the money from the account if available
void WithdrawMoney(double *accountPtr, char letter)
{
   double money;
   printf("How much amount do you want: ");
   scanf("%lf",&money);
   if(letter=='R' && *accountPtr>MAXCREDIT && *accountPtr-money>=MAXCREDIT )
       *accountPtr=*accountPtr-money;
   else if(*accountPtr>=money && letter!='R')
       *accountPtr=*accountPtr-money;
   else
       printf("You dont have enough balance to withdraw!");
}

//main function
void main()
{
   double checkingAcc = 480.45, savingsAcc = 124.62, creditAcc = -2134.78;//initial balances
   int choice=0;
   Greeting();   //call greeting function
   while(choice!=-1)   //while choice not equal to -1 repeat loop
   {
       printf(" ************************************* ");
       //calls for balances
       AccountBalance(checkingAcc, 'C');
       AccountBalance(savingsAcc, 'S');
       AccountBalance(creditAcc, 'R');
       RunBankChoices(&choice);   //call choices
       TransactionDecision(choice, &checkingAcc, &savingsAcc, &creditAcc);   //call transactions
   }
}


output:--

*************************************
Welcome to the Bank of COP 2220
It is a pleasure to manage your checking, savings, and credit accounts
*************************************

--You currently have 480.450000 in your checking account
--You currently have 124.620000 in your savings account
--You currently have -2134.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 1
Amount to deposit: 100

Money Deposited..!
*************************************

--You currently have 580.450000 in your checking account
--You currently have 124.620000 in your savings account
--You currently have -2134.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 2
How much amount do you want: 100

Money Debited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 124.620000 in your savings account
--You currently have -2134.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 3
Amount to deposit: 200

Money Deposited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 324.620000 in your savings account
--You currently have -2134.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 4
How much amount do you want: 300

Money Debited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 24.620000 in your savings account
--You currently have -2134.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 5
Amount to deposit: 100

Money Deposited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 24.620000 in your savings account
--You currently have -2034.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 6
How much amount do you want: 1000

Money Debited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 24.620000 in your savings account
--You currently have -3034.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 6
How much amount do you want: 1000

Money Debited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 24.620000 in your savings account
--You currently have -4034.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: 6
How much amount do you want: 1000
You dont have enough balance to withdraw!
Money Debited..!
*************************************

--You currently have 480.450000 in your checking account
--You currently have 24.620000 in your savings account
--You currently have -4034.780000 in your credit account
---------------------------------------------
(1) to DEPOSIT to CHECKING
(2) to WITHDRAW from CHECKING
(3) to DEPOSIT to SAVINGS
(4) to WITHDRAW from SAVINGS
(5) to DEPOSIT to CREDIT
(6) to TAKE an ADVANCE from CREDIT
(7) for all ACCOUNT BALANCES

(-1) QUIT
Enter your choice: -1


Process exited normally.
Press any key to continue .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote