Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bank Customers Data You are asked to develop an application that prints a bank customers names, IDs, and accounts balances in different ways after calculating

Bank Customers Data

You are asked to develop an application that prints a bank customers names, IDs, and accounts balances in different ways after calculating how much money they have in their different accounts. In this program you need to read a file of customers data into different arrays, pass these arrays to functions as (array parameter), calculate the total balance for each customer, then print some information.

The input file input.txt contains the following information (ID, first name, last name, savings account balance, checking account balance). You have to store these different columns in different arrays where each index represents a customer data.

Preliminaries

We will consider the file contains 10 rows maximum. So all your arrays size must be at least 10.

Since the size of all the arrays is 10, so it is better to create a constant variable with the value 10 than hard coding the arrays size. Hint: You will need to pass this constant to your functions later on as your array

size to limit your loops iterations.

Create five different arrays with different types based on the data in the file.

Create an ifstream object to read the data from the input file.

Read and store the data from the input file in your arrays using a single for loop.

Create a switch statement with four options and the output should be generated based on the chose

option. Check the options bellow:

Required functions:

1. A function printCustomersData should be called when the user chooses the first option. This function is of type void (it does not return anything). printCustomersData function accepts six parameters (five arrays and the size). This function should print a table of the customers data. Check the function prototype below:

void printCustomersData(const int id[], const string first[], const string last[], const double savings_Account[], const double checking_Account[], int size); Output of option 2:

Note that the switch statement must be inside a while loop, which means that after each option

selection, the options will be printed again. 2. The function printNames prints the ID, first, and last name of each customer (the output should also

be as a table). This function accepts four parameters (three arrays and the size). See the function prototype bellow:

void printNames(const int id[], const string first[], const string last[], int size);

3. The function printTotal that prints all customers IDs, the balance of the savings account, the balance of the checking account, and the total balance for each customer (savings balance + checking balance). As mentioned before, the output has to be in a table. This function accepts four parameters (three arrays and the size). This is the function prototype:

void printTotal(const int id[], const double savings_Account[], const double checking_Account[], int size);

If the user entered something not in the options such as the letter a, the application should not be terminated. Instead, the application should print a message that tells the user that his/her input was incorrect, then the options should be displayed again, and the application should ask the user to enter another option.

As mentioned before, the options will be printed after each selection. Even when the user enters an invalid value. The only way to terminate the program is to enter q or Q which is the fourth option.

Control Flow:

The application should start by reading the data from the input file. Then create a while loop to repeat the options after each selection. Within the while loop, create your switch statement that contains the different options. Each case/option inside the switch statement should execute a function call.

Hints:

All arrays must be passed as constant array parameters, since all functions will print these arrays without changing their items value.

Create a constant variable to use it as the size of the arrays.

Create an if statement to check if the file reading process went well. You can use many expressions

such as: (!fin) or (fin.fail()), etc.

Do not forget the break statement after each case inside the switch statement.

Use the function setw(number) that helps you to print the data in a shape of table. This function sets

the number of spaces for each output. The function is in the library.

Do not forget to write a proper algorithm at the beginning of your code.

Write some comments that help the reader to understand the purpose of each loop and function. Inside

functions, write preconditions and postconditions.

Save the whole project and zip it before uploading it to Blackboard. (Do not submit only the .cpp file

and do not copy and paste your code to a .txt file or Word file).

Submission: Zip up your entire project folder and submit the zip file to Blackboard by the deadline.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Persuasive Speaking Organizing Patterns in Persuasive Speaking?

Answered: 1 week ago