Question
for Microsoft visual studio int main(void) { char code; double amount, service, balance; double amtCheck, amtDeposit, openBalance, closeBalance; int numCheck, numDeposit; fopen_s(&fpIn, account.txt, r); if
for Microsoft visual studio
int main(void) { char code; double amount, service, balance; double amtCheck, amtDeposit, openBalance, closeBalance; int numCheck, numDeposit;
fopen_s(&fpIn, "account.txt", "r"); if (fpIn == NULL) { printf("account.txt could not be opened for input."); exit(1); } fopen_s(&fpOut, "csis.txt", "w"); if (fpOut == NULL) { printf("csis.txt could not be opened for output."); exit(1); } amount = 0.0; service = 0.0; balance = 0.0; amtCheck = 0.0; amtDeposit = 0.0; openBalance = 0.0; closeBalance = 0.0; numCheck = 0; numDeposit = 0;
outputHeaders();
while (!feof(fpIn)) { fscanf_s(fpIn, "%c %lf ", &code, 1, &amount); if (code == 'I') { initialBalance(amount, &balance, &service, &openBalance); } else if (code == 'D') { deposit(amount, &balance, &service, &numDeposit, &amtDeposit); } else { check(amount, &balance, &service, &numCheck, &amtCheck); } } closeBalance = balance - service; outputSummary(numDeposit, amtDeposit, numCheck, amtCheck, openBalance, service, closeBalance);
fclose(fpIn); fclose(fpOut); return 0; }
Checking Account Lab bly checking ons. An input ct a C program, check.s, that reads the details of a monthly che it and outputs a bank statement summarizing these transactions ccount.txt, contains a list of transactions for the checking account one month. Each line of the input file consists o s of a one-character transaction along with a double containing the amount of the transaction. Valid Construct a C program, account and outputs a ba file, account. code along with a double transaction codes are as follows: tal balance brought forth from previous month Deposit Check As each transaction is entered, you should output on a single line the type of transaction, the amount of the transaction (separate columns for deposits and checks), and the balance after the transaction has been processed: Transaction Balance Deposit Check 478.83 Initial Balance Deposit Deposit Check Check 127.45 61924 1226.12 281.00 276.24 The bank's service charges (which should be deducted from the balance at the end of the month) are as follows: $3.00 per month to maintain the account 30.06 for each check cashed 30.03 for each deposit made 0 overdraft whenever a check cashed leaves the balance below 30. Note: Do not ass te no not assess the overdrait service charge when the transaction is a into an overdrawn account that does not bring the balance above zene should also include the following summary into me bank statement sho ng balance balance Shown below is the man Please do not modify change in syntax for an fa is the main() function that you should use for your program at modify the main function, unless your compiler requires a syntax for an fopen() or an fscanf() function double amount, service, balance: ble at Check, amt Deposit, Open Balance, closeBalance int numCheck, numDeposit: fopen (fpin, "account.txt","1"); if (fpin = NULL) print("account.txt could not be opened for input."): exit (1): fopen (fpOut, "cais.txt", "W"); if (fpOut == NULL) printf("csis.txt could not be opened for output."); exit (1) amount = 0.0: service = 0.0; balance = 0.0; amt Check -0.0; ant Deposit = 0.0; openBalance - 0.0; closeBalance - 0.0; = 0; Oi ni Check umDeposit output Headers (): code, 1. Samount): while (!feof(fpin) fscanf sifpin, "lesin", if (code - "I' I initial Balance (amount, balance, service, Gopen Balance); else if code 1 deposit camount. balance, service, SnumDeposit, samt Deposit); check(amount, sbalance, service, Snum Check, Gamt Check): closeBalance = balance - Services at Snip output Summary inumDeposit, amt Deposit, numCheck, amt Check, openBalance, service, closeBalance: felose itpin); felose if pout); return 0; You will need to write five functions (and their prototypes) for your program: Cutout Headers () initial Balance deposito check() output Summary) These functions will use counters and summations to keep track of the different components of the checking account as well as output specific information relating to the bank statement. Note that some of the function parameters are nassed as input parameters (by value) and some are passed as input-output parameters (by reference). Be sure to use the address of operator and the indirection operator (") correctly in your functions. Remember that the main () function should appear as the first function in me nrogram. Be sure to use function prototypes for each of the functions that are used in your program. contents of account.txt are shown below 3 127.45 619.84 945.12 32.91 1.06 184.32 495.18 141.81 255.10 250.00 123. 245.05 873.25 981.12 317.84 812,23 606.12 Rectangular Snip You should not be using any global variables, other than declarations for file pointers, in your program other than file pointers. A global variable is a variable declared outside of main(). Output from your program should be sent to the terminal window (your screen) as well as the requested csis.txt output file. Be sure to read the document on Capturing Program Output. Your full name must appear as a comment in the source file that contains main(). Be sure to include the csis.txt output file in your zip archive Note: to tell Xcode where to find an input file placed in the program's project folder, see instructions on page 24Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started