Write a simple cpp program for the bank accounts

Assignment Help C/C++ Programming
Reference no: EM131628912

Assignment: C++ Program

Write A Simple C++ Program for the bank accounts.

You have been hired as a programmer by a major bank. Your first project is a small banking transaction system. Each account consists of a number and a balance. The user of the program (the teller) can create a new account, as well as perform deposits, withdrawals, balance inquiries, etc..

Initially, the account information of existing customers is to be read into a pair of parallel arrays--one for account numbers, the other for balances. The bank can handle up to MAX_NUM accounts. Use the following function to read in the data values:

int read_accts(int acctnum_array[], double balance_array[], int max_accts);

This function fills up the account number and balance arrays (up to max_accts) and returns the actual number of accounts read in (later referred to as num_accts).

After initialization, print the initial database of accounts and balances. Use function print_accts() described below. The program then allows the user to select from the following menu of transactions:

Select one of the following:

W - Withdrawal
D - Deposit
N - New account B - Balance
Q - Quit
X - Delete Account

Use the following function to produce the menu:

void menu();

This function only displays the menu. The main program then prompts the user for a selection. You should verify that the user has typed in a valid selection (otherwise print out an error message and repeat the prompt).

Once the user has entered a selection, one of the following functions should be called to perform the specific transaction. At the end, before the user quits, the program prints the contents of the account arrays.

int findacct(int acctnum_array[], int num_accts, int requested_account);

This function returns the index of requested_account in acctnum_array if the account exists, and -1 if it doesn't. It is called by all the remaining functions.

void withdrawal(int acctnum_array[], double balance_array[], int num_accts);

This function prompts the user for the account number. If the account does not exist, it prints an error message. Otherwise, it asks the user for the amount of the withdrawal. If the account does not contain sufficient funds, an it prints an error message and does not perform the transaction.

void deposit(int acctnum_array[], double balance_array[], int num_accts);

This function prompts the user for the account number. If the account does not exist, it prints an error message. Otherwise, it asks the user for the amount of the deposit.

int new_acct(int acctnum_array[], double balance_array[], int num_accts);

This function prompts the user for a new account number. If the account already exists, it prints an error message. Otherwise, it adds the account to the account array with an initial balance of 0. It returns the new number of accounts.

int delete_acct(int acctnum_array[], double balance_array[], int num_accts);

This function prompts the user for an account number. If the account does not exist, or if the account exists but has a non-zero balance, it prints an error message. Otherwise, it deletes the account. It returns the new number of accounts.

void balance(int acctnum_array[], double balance_array[], int num_accts);

This function prompts the user for an account number. If the account does not exist, it prints an error message. Otherwise, it prints the account balance.

void print_accts(int acctnum_array[], double balance_array[], int num_accts);

This function prints all customer information--account number and balance.

Notes:

1. All output must be file directed
2. Only output must go to the file - not interactive prompts or menus (which go to the monitor).
3. No global variables are allowed
4. The program and all functions must be properly commented.
5. The program must be properly tested.

a. The initial database should consist of at least 5 accounts

b. The initial database should be printed to the file

c. Test at least 2 invalid menu selections

d. Test at least 2 balance inquiries:

i. valid account
ii. invalid account

e. Test at least 3 deposits:

i. valid account - valid deposit amount
ii. valid account - invalid deposit amount
iii. invalid account

f. Test at least 4 withdrawals:

i. valid account - valid withdrawal amount
ii. valid account - invalid withdrawal amount
iii. valid account - insufficient funds
iv. invalid account

g. Create at least 3 new accounts with an initial balance of 0.0

h. Test the creation of at least 1 invalid new account

i. Test several transactions on the new accounts (deposits, withdrawals, etc.)

j. Delete at least two accounts (1 old account and 1 new account but not the last new account created)

k. quit and print the final database.

Reference no: EM131628912

Questions Cloud

Identify the reason for the conflict and the opposing forces : Identify the reason for the conflict and the opposing forces. Accurately identify the key political figures that impact the outcome or resolution of conflict.
Discuss land is vacant land with no utilities : Assume land is vacant land with no utilities but they can be run to the property
Find the number of years of coverage cash value : Marquesha Long at age 55 wants to convert her $200,000 whole-life insurance policy to extended term insurance with the same face value.
Discuss fours discussions of ethical theory : the legal and ethical questions raised using the text. You may want to review chapter four's discussions of ethical theory
Write a simple cpp program for the bank accounts : Write A Simple C++ Program for the bank accounts. Each account consists of a number and a balance. The user of the program can create a new account.
Write a summary of the history of computer networks : Write a summary of the history of computer networks. Please include major events until the year of 2017
Centers for disease control and prevention : Have you ever participated in an outbreak investigation or care of a person during such an event?
Analysis important to the management of an organization : Analysis of cost behavior provides a way of determining how a specific cost will increase or decrease, based on changes in the activity levels
Managing innovation and change in education : Managing Innovation and Change in Education - describe and compare the leadership style characteristics displayed at various times, including the strengths

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement a matrix class for two-by-two matrices

Implement a Matrix class for 2-by-2 matrices. Include a default constructor, a copy constructor, an inverse() function that returns the inverse of the matrix.

  Implement database having array of pointers

One way to implement this database is to have an array of pointers pointing to Employee objects. You will obviously require a function named Calculate_salary() which will be different for each employee class. Write code in c++

  Write a program to swap value of two variables without using

Write a program to swap value of two variables without using third variable. Write a program which input three numbers and display the largest number using ternary operator. Write a program which accepts amount as integer and display total number of ..

  Implementing calculator functionality

Implementing Calculator Functionality. If when you load your project you have an error panel appear that tells you the Designer view could not be loaded, close this panel and right click on CalculatorForm.h in the Solution Explorer and select View ..

  Computes a students grade for an assignment

Write a C++ program that computes a student's grade for an assignment as a percentage given the student's score and total points.

  Write a body mass index calculator

Write a Body Mass Index calculator in C++. Input will be a person's height in feet and inches as well as their weight in pounds and ounces.

  Write a program that calculates an employees wage for a

write a program that calculates an employees wage for a week. an employees wage is calculated as followsi if the number

  Evaluate its employees four times a year at the end of year

The data will be validated and saved to an output file,"datainput" . this program will use five arrays to grater manupliate and store the data.

  Write a function to compute the average amount of food eaten

Write a function to compute the average amount of food eaten per day by the whole family of monkeys; write a function to compute the least amount of food eaten by any monkey.

  Write a driver program to test your function

Also write a driver program to test your function. What happens if you enter units other than those listed?

  Write cpp program that declare single dimensional arrays

Write a c++ program that declare three single dimensional arrays nammrs: price, quantity, amount. Number for the price.

  What is the time-complexity of the overloaded assignment

What is the time-complexity of the overloaded assignment operator

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd