CSCE 1030: Project 3 Due: 11:59 PM on Sunday, April 18, 2021 PROGRAM DESCRIPTION In this project, you have to write a C++ program to keep track of banking transactions in multiple disk files. Your...

1 answer below »
Please see attached Project 3.pdf file for instructions. The rest of the files are provided to you to complete the assignment.


CSCE 1030: Project 3 Due: 11:59 PM on Sunday, April 18, 2021 PROGRAM DESCRIPTION In this project, you have to write a C++ program to keep track of banking transactions in multiple disk files. Your objective is to get transactions from a user and process the transactions for debiting or crediting the account. Each user holds two accounts – a business account and a personal account. You are provided the following files. Download them and view their contents. account_data: This file contains the account name and the account number. The name and the number are separated by a comma. 145268p: This file contains the personal transactions made by the account number 145268. If you look at the account_data.dat file, you will see this account belongs to John Smith. 145268b: This file contains the business transactions made by the same account. You may choose to create your own transaction files with arbitrary data to test your program for different accounts. This is an extension of Projects 1 and 2 so you may reuse any work you have done for Projects 1 and 2. PROGRAM REQUIREMENTS 1. As with all projects in this course, your program’s output will display your name, your EUID, your e-mail address, the department name, and course number. This means that your program will print this information to the terminal (see the sample output). 2. Declare and initialize the following global parameters. • A global integer constant to store the length of account number and initialize it to 6. • An enumeration constant with values Business and Personal and assign integer values 0 and 1 to the data items, respectively. They represent the type of bank account. • Another enumeration constant with values Add, Remove, Process, Display, and Quit, and assign integer values 1, 2, 3, 4 and 5 to the data items, respectively. They represent menu choice presented to the user. • A structure named Account with the following members. o Name of the account o Number of the account o Type of the Account (i.e. Business or Personal) ➢ You must use a suitable enum type variable for this member. 3. In your main function: • Display a menu for the user (SEE SAMPLE OUTPUT) that provides the user the following choices. o Add a new account o Remove an existing account o Process new transaction on an account o Display the stored transactions on an account. o Quit the program • Using a suitable message, ask the user to make the menu choice using an integer variable. • Based on the value entered by the user for menu choice, design a switch-case block to implement the following requirements. o You must use the enumeration constants to set up your cases. o You must use a variable of your enumeration constant type for switching control. o If the user chooses to add an account ➢ Call the function addAccount o If the user chooses to remove an account ➢ Using a suitable message, ask the user the account number of the account to remove. ➢ Call the function removeAccount and pass the account number entered by the user. o If the user chooses to process transactions for an account ➢ Using a suitable message, ask the user the account number of the account to process transactions for. ➢ Call the function processAccount and pass the account number entered by the user. o If the user chooses to display transactions for an account ➢ Using a suitable message, ask the user the account number of the account to display transactions for. ➢ Call the function displayAccount and pass the account number entered by the user. o If the user choose to quit the program. ➢ Exit the program with a suitable message. o If the user chooses anything else, execute the default case to notify the user an incorrect choice. ➢ Using a suitable loop, ask the use for the choice again. ➢ Your program must keep on looping until the user enters the correct choice 4. Write a function named getName which gets the name on the bank account. Inside the function: • Using a suitable message, prompt the user for the name on the account. The name can have multiple words. • Only alphabets (A-Z or a-z) and whitespaces are permitted in the account name. o If the user enters any other characters in the name, you need to generate an error message and ask for the name again. o Your program must keep on asking the user to enter the name until the user enters it correctly. • The user may type the name in either uppercase or lowercase, but you need to convert every initial to uppercase. • This function will be called by the addAccount function. 5. Write a function named getAccountNumber which get the account number. Inside the function: • Using a suitable message, prompt the user for the number of the account. • The account number must be a 6-digit number. • If the user enters an account number with more than 6 digits generate an error message and ask the user to enter the number again. • Only numbers 0-9 are permitted in the account number. If the user enters an account number with non-numeric characters, generate an error message, and ask the user to enter the number again. • Your program must keep on asking the user to enter the number until the user enters it correctly. • This function will be called by the addAccount function. 6. Write a function named getNumberofTrasanctions. It accepts a string that stores the filename of a disk file and return an integer representing the number of transactions in the disk file. • Inside the function, open the file for reading using the filename passed to the function. • Count the number of transactions in the file. • For example, the file 145268b has 7 transactions. Hence the name of the file 145268b has to be passed to this function and it has to return 7. The return value will change after you edit the file. 7. Write a function named getNumberofAccounts. It accepts a string that stores the filename of a disk file and return an integer representing the number of accounts in the disk file. • Inside the function, open the file for reading using the filename passed to the function. • Count the number of accounts in the file. • For example, the file account_data has 4 accounts. Hence the name of the file account_data has to be passed to this function and it has to return 4. The return value will change after you edit the file. 8. Write a function named addAccount. It does not have any parameters. • Inside the function, open the account_data file for appending. • Call the function getName to get the name of the new account. • Call the function getNumber to get the number of the new account. • Add the new account information to the data file in the same format (SEE SAMPLE OUTPUT). 9. Write a function named removeAccount. It accepts the account number to be removed. • Inside this function, call function getNumberofAccounts to get the current number of accounts in the data file account_data. • Create a dynamic array of the structure type Account. Use the number of accounts in the data file for size of this dynamic array. • Open account_data.dat file for reading. • In a loop, read one line of the file at a time and store appropriate data in the dynamic array. Note that each element of the structure array will be an account available on a line of the file. o While reading check if the account number being read from the file matches the account number to be removed. o If you find match, use a Boolean flag to store that you have found a match. o Copy the entire file to your dynamic array whether or not you find a match. • Close the file. • If you have found a match while reading: o Open account_data.dat file for writing. o Write the contents of the dynamic array into the file, only if the account number does not match the account number to be removed. • If you have not found a match while reading: o Notify the user with a suitable message to indicate the account number does not exist. • Close the file. 10. Write a function named getCurrentBalance. • This function accepts two parameters: the account number and the type of account to get the balance of. The account type must be an enum data type. • This function returns the current balance of the account being read. • Inside the function, open the appropriate file for reading. For example, open the file 145268b if the account number is 145268 and the account type is Business. • Inside a loop, read the transactions in the file to find their sum. • Return the computed sum representing the current account balance. 11. Write a function named writeTransactions. • This function accepts two parameters: the account number and the type of account to get the balance of. The account type must be an enum data type. • Inside the function, open the appropriate file for appending. For example, open the file 145268b if the account number is 145268 and the account type is Business. • Using a suitable message, ask the user for the transaction value. • Write the transaction value to the appropriate file. 12. Write a function named displayAccount. It accepts the account number of the account to be display the transactions for. • Inside this function: o Using a suitable message, ask the user which account needs to be displayed – Business or Personal. Use an integer variable for this purpose. o Using a suitable message, ask
Answered 1 days AfterApr 16, 2021

Answer To: CSCE 1030: Project 3 Due: 11:59 PM on Sunday, April 18, 2021 PROGRAM DESCRIPTION In this project,...

Aditya answered on Apr 18 2021
134 Votes
#include
#include
#include "euidProject3_header.h"
using namespace std;
int m
ain()
{
int option;
string input;
bool checkInput;
cout << "+-------------------------------------------------+" << endl;
cout << "| Computer Science and Engineering |" << endl;
cout << "| CSCE 1030 - Computer Science |" << endl;
cout << "| Student Name EUID [email protected] |" << endl;
cout << "+-------------------------------------------------+" << endl;
while (true)
{
cout << "\n1. Add Account" <<...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here