Ask C/C++ Expert


Home >> C/C++

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.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92437621

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As