Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This problem is a checking account with online access. The primary goal of this problem is to implement and know when to implement pass by

This problem is a checking account with online access. The primary goal of this problem is to implement and know when to implement pass by reference and pass by value. The goals are: 1. Write the functions 2. Write the prototypes 3. Write the function calls 4. Know when to pass by reference and pass by value.

Problem statement: The program starts by asking the user the beginning balance of the account. The opening (or beginning) balance must be between 100 and 5000 dollars otherwise an error message prints and the program is done.

Once the initial balance is entered correctly the program can begin completing transactions.

Users will complete several transactions until Q is entered. The transactions are: B Print available balance D Deposit an amount entered by user into the account. Deposit may be between 20 and 1000 dollars. After deposit print current balance. W Withdraw an amount entered by the user. User must have money available or the withdraw is canceled with an error message printed Print the current balance is printed. Q Quit the program and display results including: The number of all transactions The number of deposits The number of withdrawals Available current balance

The functions to be implemented are prt_bal, deposit, withdraw, finalReport For all the functions determine the information passed as well as how to pass it. Complete all the calculations to ensure the final balance is correct. Print results as indicated in the transactions listed above.

/* Checking account code below, please fill in typed in this file*/

/*Name:

*/

#define _CRT_SECURE_NO_WARNINGS #include

//prototypes

void printInstructions(); void acctSetup(double *openBalance, double *curBalance);

int main(void) { char code; double amount = 0.0; double openBalance = 0.0, curBalance = 0.0; int numDeposit = 0, numWithdraw = 0, numTrans = 0; int done = 0;

printInstructions(); acctSetup(&openBalance, &curBalance);

printf("Please first action (P-Print Balance, D-Deposit, W-Withdraw, Q-Quit "); scanf("%c", &code); while (code != 'Q') {

if (code == 'P') { printf("P was chosen"); //prt_bal( ); } if (code == 'D') { printf("D was chosen"); //deposit( ); } if (code == 'W') { printf("W was chosen"); // withdraw( ); } printf("Please enter next code: "); scanf("%c", &code); code = toupper(code); }

//finalReport call here

return 0; }

/*FUNCTIONS*/

void printInstructions(void) { //assume correct }

void acctSetup(double* openBalance, double* curBalance) { int done = 0; double amount = 0; while (done == 0) { printf("Please enter starting balance of account : "); scanf("%lf", &amount); if (amount < 20 || amount > 1000) printf("Starting amounting not in proper range, must be between 20 and 1000 "); else { *openBalance = amount; *curBalance = amount; done = 1; } } }

//Write the functions below including: prt_bal, deposit, withdraw, finalReport

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

Step: 3

blur-text-image

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

What information is required for an investment approval request?

Answered: 1 week ago