Subject Computer Science C-Family Programming

Question

Problem statement: Write a C++ program that reads a customer’s checking account information from a dat file and calculates his/her account balance. In particular, a menu‐based application should be developed to perform the following functionalities iteratively until the user request to quit the program:
1. Display the account summary: This option allows the user to enter a 3‐digit customer ID, reads an appropriate dat file corresponds to the customer ID and displays the account information including the total account balance on the console.
2. Deposit the amount into the account: This option allows the user to enter a 3‐digit customer ID, adds the requested amount at the end of the file, and saves the file. The option should display the account information including the total account balance on the console.
3. Withdraw the amount from the account: This option allows the user to enter a 3‐digit customer ID, reads the customer’s dat file, verifies that the requested withdrawal is less than the account balance and then add the withdrawal amount at the end of the file. The option should display the account information including the total account balance on the console. In case, if the requested withdrawal is greater than the account balance, the program should display an error message and terminate the transaction.
4. Quit the program: This option terminates the program.
Four test files are provided to test your program. The dat files are named based on the customer id. For instance, the first customer of the bank is the author of the book, Tony Gaddis and his customer ID is Cust_001. The dat file of his checking account is Cust_001.dat.
Test Cases:
1. Cust_001 request to check his balance
2. Cust_020 request to deposit $1000 to his account
3. Cust_007 request to withdraw $100 from his account but he has only $10 account balance

Also, You will have to implement at least one function apart from the main() function for the homework program. For example, you may have a function say, accountSummary() for reading and displaying the account transactions.

For test files, see Question.zip

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <iostream>
#include <fstream>
#include <string>
#include <time.h>

using namespace std;

void accountSummary(string userID);
void deposit(string userID);
void withdraw(string userID);

int main()
{
//Variable declarations
int choice;
string userID;
choice = 0;
//Run the loop forever. The stopping condition is inside
while(true)...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Programming Questions
Homework Solution
$20.00
Programming
C++
Computer Science
Integers
Series
Savings Accounts
Balance
Loops
Statements
Variables
Interest Rates
Deposits
Withdrawals
Input
Output
Programming Problems
Homework Solution
$50.00
Programming
C
Computer Science
Sorting
Integers
Arrays
Statements
Variables
Loops
Functions
Input
Output
Echo
Unix Commands
Memory
Strings
Line Arguments
Duplicates
Functions in Programming Language C
Homework Solution
$5.00
Programming
Computer Science
Arrays
Arguments
Integers
Elements
Variables
Statements
Distances
Absolute Values
Indexes
Input
Output
Get help from a qualified tutor
Live Chats