Question
Intro to Programming in C program 5 Assignment purpose: To compile, build, and execute an interactive program using functions from stdio.h (printf and scanf), math
Intro to Programming in C program 5 Assignment purpose: To compile, build, and execute an interactive program using functions from stdio.h (printf and scanf), math in C, condition PRACTICE, a while loop, file input and output processing , and programmer defined functions. Instructions: For this assignment you will be implementing a program that simulates a banking application deposit ONLY with 2 accounts: checking and savings. The checking and savings balances will be read from and written back to a txt file called balancesInput.txt" You should be familiar with program 4 before starting program 5 Use the following programmer defined functions. DO NOT modify the Functions: //function prototypes DO NOT MODIFY THE FUNCTIONS //greets the user void Greeting(); //SAME AS PROGRAM 4 //Input: one double and one character //displays the balance of the account ('C', checking or 'S', savings) void DisplayBalance(double accountBalance, char account); //SAME AS PROGRAM 4 //Input: one double and one character //declare, ask, and get the amount from the user and add it to the account //return the updated balance ('C', checking or 'S', savings) double DepositMoney(double accountBalance, char account); Use the template code provided to create the file with the checking and savings account balances in the file: int main() { double checkingBalance = 120.67; double savingsBalance = 423.12; FILE* outPtr; FILE* inPtr; //creating the file and "write" the initial balances outPtr = fopen("balancesInput.txt", "w"); fprintf(outPtr, "%f ", checkingBalance); fprintf(outPtr, "%f ", savingsBalance); //Open the file and "read" the balances inPtr = fopen("balancesInput.txt", "r"); fscanf(inPtr, "%lf", &checkingBalance); fscanf(inPtr, "%lf", &savingsBalance); //the rest of the main function code and while loop //save the new balances to the file at the end, right before return 0 printf(" Saving to the file "); fprintf(outPtr, "%f ", checkingBalance); fprintf(outPtr, "%f ", savingsBalance); return 0; }
Please use an app with only deposit Or quit MENU OPTIONS 1. Initialize the balance in the checking and savings account with the template code provided 2. The program will welcome the user with a friendly message and instructions. 3. Display the balance in both accounts at the start of execution 4. Display the item options: (d) to DEPOSIT (q) to quit 5. The user will make the selection (d) or (q) 6. Remember that lowercase and uppercase letters are not the same 7. If the user selects d or D they with then have the option to select (1) for checking or (2) for savings 8. The purpose of this assignment is to practice, loops, conditions, functions, and files 9. More features to the bank app will be added in program 6 The user may continue to make deposits until entering (Q) to QUIT When the user selects (Q) or (q) the new balances will be saved to the file See the template code provided with the assignment.
Step 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