Question
Write a C++ program. This program tests the concepts of: File Streams Classes Problem: You have been hired by a bank to create a program
Write a C++ program. This program tests the concepts of:
File Streams
Classes
Problem:
You have been hired by a bank to create a program that will process transaction logs.
The banks transactions logs are in the format:
- Header row is first line of the file, line starts with a # character
~ #CustomerNumber Customer Name
- Each row after that is a transaction
- Char Char Double
~ First column is
- S = Savings
- C = Checking
- B = Both savings and checking
~ Second column is action
- D = Deposit
- W = Withdrawal
- I = Interest rate change (APR changed, no change to balances, it should be assumed that interest is posted MONTHLY)
- P = Interest posted to account
- X = Transfer money from the FIRST COLUMN account to the other For Example, if the log line has:
C X 50.00
This transaction transfers $50 from Checking into Savings
~ Third column is the amount of money or interest rate that the transaction acts on. If the action is P, this number will be 0, since it is not used.
~ If insufficient funds to complete a withdraw or transfer, $10 is subtracted from the account instead. This means that accounts can go negative!
Coding requirements:
- Classes are required
~ A class for Account
- this object will store as private data fields
~ balance
~ annual percentage rate (interest)
- Minimum Actions
~ Deposit
~ Withdraw
~ Transfer
~ Post Interest
~ Set the annual percentage rate
~ Get the balance
~ A class for BankCustomer
- this object will store as private data fields
~ Savings account (using Account)
~ Checking account (using Account)
~ Customer Number
~ Customer Name
- Minimum Actions:
~ Get customer name
~ Get customer number
~ Get Savings balance
~ Get Checking balance
~ processTransationLog
- Filename of log should be passed to this function
- Function should return the number of transactions processed
- Function should abort if any invalid transactions are encountered, for example log format not valid.
- This function OPEN the passed filename. Reads in customer name and customer number and modifies object. The function than proceeds to process the transactions.
~ Your classes should NOT output anything to stdout under any circumstance or ask for any input. All interaction with the user should be handled in your main driver.
- Main Driver
~ Your main function will create an object of your BankCustomer class. A prompt will ask for a file name that will be used as the transaction log. This file name will be sent to processTransationLog. You will output the final results.
Given Files:
- log1.txt
- log2.txt
- log3.txt
- log4.txt
- log5.txt
- log6.txt
*EXAMPLE OF LOG FILE:
#1001 Wendy Lee S D 50.00 C D 75.00 B I 3.15 B P 0 S W 10.0 C W 5.0 S X 25.0 S D 100.00
*Must all be separate executions. Each execution is separated by:
#######################################################################
$./project_ch5_bank
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