Question
THIS CODE IS SUPPOSED TO BE WRITTEN WITH C++. a) Then, b) Modify Program1 to include a function getEndBalance that computes the ending balance of
THIS CODE IS SUPPOSED TO BE WRITTEN WITH C++.
a)
Then,
b)
Modify Program1 to include a function getEndBalance that computes the ending balance of a savings account. The function takes three arguments that hold the starting balance, total deposits, total withdrawals and returns the ending balance. The ending balance is printed in main. This should be done in a separate program/instance, but you should be able to just copy and paste Program1 and make changes.
DO NOT COMBINE STEP a) AND STEP b) OR IT WILL BE INCORRECT. They should be different programs, with b) having an additional step. If this cannot be done, I can post a second question, but it's more important for me that program1 is done correctly.
IT IS ALSO VERY IMPORTANT THAT NAMED CONSTANTS ARE USED.
The result of your changes to accounts.txt should be displayed in terminal after writing to it, formatted exactly how the sample output file is shown.
PLEASE READ MY DIRECTIONS BEFORE STARTING THIS PROBLEM. I will upvote as soon as I am happy with the answer.
This is what the final product should look like:
Thank you.
Program1 Write a program that calculates the ending balance of several savings accounts. The program reads information about different customers' accounts from an input file, "accounts.txt". Each row in the file contains account information for one customer. This includes: the account number, account type (premium, choice, or basic account), starting balance, total amount deposited, and total amount withdrawn Your program should open the file and check for successful open, then calculate the ending balance for each customer account. The calculated data must be saved in an output file, "accountsOut.txt", in a neat format as shown below. You may assume that the interest is 5% for premium accounts, 3% for choice accounts, and 1% for basic accounts. - You MUST use a named constant for the interest rates. Since the results displayed are monetary values, your output must be displayed with two decimal places of precision. Be sure decimals "line up" when you output the final accounts information. And do not forget to close the files when done with them Sample input file 234019 Premium 50100.44 25500.00 14792.91 234490 Choice 35000.52 14000.0015780.88 347269 Premium 80400.00 28750.00 15598.70 239801 Basic 5504.29 1700.00 1600.76 487241 Basic 4023.00 1950.00 1500.00 982111 Choice 9245.00 12300.00 11768.98 Sample output file: Account Type StartBalance Deposit Withdrawal EndBalance 234019 Premium 50100.44 234490 Choice 35000.52 347269 Premium 80400.00 239801 Basic 487241 Basic 982111 Choice 25500.00 14000.00 28750.00 1700.00 1950.00 12300.00 14792.91 15780.88 15598.70 1600.76 1500.00 11768.98 63847.91 34216.23 98228.87 5659.56 4517.73 10069.30 5504.29 4023.00 9245.00 Notes: you must create the input file "accounts.txt" using emacs first you do not need to use functions in this program. - - Account Type StartBalance Deposit Withdrawal EndBalance 234019 Premium 234490 347269 Premium 239801 487241 982111 50100.44 35000.52 80400.00 5504.29 4023.00 9245.00 25500.00 14000.00 28750.00 1700.00 1950.00 12300.00 14792.91 15780.88 15598.70 1600.76 1500.00 11768.98 63847.91 34216.23 98228.87 5659.57 4517.73 10069.30 Choice Basic Basic Choice The account Balance details are written to file accountsOut.txt
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