Question

C++ Design a class bankAccount that defines a bank account as an ADT and implements the...

C++

Design a class bankAccount that defines a bank account as an ADT and implements the basic properties of a bank account.

The program will be an interactive, menu-driven program.

a. Each object of the class bankAccount will hold the following information about an account:

account holder’s name

account number

balance

interest rate

The data members MUST be private.

Create an array of the bankAccount class that can hold up to 20 class objects.

b. Include the member functions to perform the various operations on objects of type bankAccount:

Include all appropriate constructors

Include any get and set member functions for member variables.   

For the account number, include a separate static member (integer) in the class to automatically assign and keep track of account numbers. Each customer should have a unique account number updated using the static member.

Add member functions to:

Set bank account data

Make a deposit into an account

Withdraw from an account. Be sure to include balance error checking, i.e., cannot withdraw more than is in the account.

Update balance with interest

Print all customer data

ALL member variables must be private and accessed through member functions. The main client program CANNOT access the variables directly.

c. Have the program provide the following capabilities (by user request):

Through a menu system provide the capability to:

(1) Add a customer. Ensure that the addition of a new customer does not cause an array overflow. The capability of entering the customer name, initial deposit amount and interest should be provided for a new customer.

(2) Print all customer data for all customers

(3) Update customer data as follows:

Request the user account number (you may need to display customer names and numbers for the user to choose) and though a submenu:

(a) Make a deposit for the customer number entered

(b) Make a withdrawal (with error checking) for the customer number entered

(c) Print balance of the customer number entered

(d) Update balance with interest for the customer number entered

(e) Exit the submenu

(4) Exit the program

d. Write the definitions of the member functions of the class bankAccount.

c. Write an interactive program that uses the class bankAccount and tests various operations on the objects of the class bankAccount. Declare an array of 20 components of type bankAccount.

f. Include error checking (invalid menu choices, subtraction errors, etc.)

g. Include menus and submenus indicating all the menu options available for (1) (4) above.

All classes must have a class definition header file (*.h) and a class implementation file (*.cpp). You must have a main program that exercises these classes (*.cpp). You must create a project in Dev C++. You must submit all header files, source files (*.cpp) and the project file (*.dev). Submit a README file that contains: The names of all your files including all the files in the project; how to compile; and how to run.

And this is what I have so far as a rough draft. I am having trouble with the functions and how i want to run the bank menu.

// header file

class bankAccount {

public :

void getdesposit(double value );

void getwithdraw(double value);

void getinterest ();

void printCustomer();

void setData();

void getName();

bankAccount(); // default constructor

bankAccount(double init_Balance); // constructor with parameters

private:

static int acctNum;

string name;

int accountNumber; // set account # to what the static int acctnum is at that time

double balance;

double interest Rate;

};

// bankacc.h the specification file for the class bankacc

#include <iostream>

#include "bankacc.h"

using namespace std;

void bankAccount::setdesposit(double value );

void bankAccount::getwithdraw(double value); // balance error checking, can't withdraw > account

//Function to retrieve money

void bankAccount::getinterest ();

void bankAccount::printCustomer(); //const

// Function to print customer's information

// Postcondition:

void bankAccount::setData();

void bankAccount::getName();

bankAccount::bankAccount () // default constructor

{

string name ="";

int accountNumber =0;

double balance =0;

double interest Rate =0;

}

bankAccount::bankAccount(double init_Balance) // constructor with parameters

{

static int acctNum =789;

string name =" ";

int accountNumber = acctNum;

double balance = 2000.00;

double interest Rate = .025;

}

// filename : Assignment 2

// Nedra Ellis

// Due Date: Oct 11

// Input: customer's information for a bank

// Output: display customer's information once everything has been entered

// This is a program to that will be user friendly and allow customers to input personal bank information

// using a class

#include <iostream>

#include "bankacc.h"

using namespace std;

int main(){

//bankAcct;

bankAcct acct[20]; // array of bankAccount

int option1,option2;

// Main Menu

cout << "Hello welcome to this bank. What can we assist you with today" << endl;

cout << "Select the your options from the following menu" << endl;

cout << "1.) Add customer." << endl;

cout << "2.) Print customer information. " << endl;

cout << "3.) Update information." << endl;

cin << option1;

do {

switch(option1)

{

case 1:

cout << "You have choosen to add a customer. " << endl;

break;

case 2:

cout << "You have choosen to print your information" << endl;

break;

case 3: // Submenu

if (option1 ==3)

{

cout << "You have choosen to update your information." << endl;

cout << "Please enter your account number" << endl;

//while loop to match account number with database {} and add function

cout << "Please from the following options." << endl;

cout << "1.) Make a deposit for the customer number entered" << endl;

cout << "2.) Make a withdrawal. " << endl;

cout << "3.) Update balance." << endl;

cout << "Exit back to main menu. "<< endl;

// call funciton to search for account number & display names and numbers

switch(option2)

{

case 1:

cout << "You have choosen to make a deposit " << endl;

break;

case 2:

cout << "You have choosen to make a withdrawal." << endl;

break;

case 3:

cout << "You have choosen to update balance with interest." << endl;

break;

default:

cout << "You have choosen to exit back to main menu. " << endl;

// figure out a way to exit the submenu

}

}

break;

default

cout << "You have choosen to exit the main menu. " << endl;

// figure out a way to exit the submenu

}

}while();

return 0 ;

}

/* int main(){

bankAcct acct[20];

//menu

1. add new customer // keep track of all customers, ctr

2. print all customer data // write individual print function that will be for each object ... acct[0], acct[1],etc //if you wanted to print all customers you could create a loop ex. for(i=0; i<ctr,i++){acct[i].print(); }

3. modify a customer // submenu, looping constructs

get customer id // (lookup) need to get customer account number, ex. print all customers you have so far and if you wanted customer # 100 loop thru array and match account number entered to the acct number for each array component to get the array index

1. deposit // ex make a deposit for customer, u found array index in list you ahve so far ex. acct[index].deposit(double value), then how much do you want to desposity and then get value and pass in value into that acct[index].deposit(double value)//

2. withdraw

3. print balance

4. update balance with interest

9. exit sub menu

// she would just create one without the array */

Any help will do and thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

BANK ACCOUNT

# include

class Bank {

int acno;

char name[30];

char account_type[10];

float balance;

public:

Bank()

{

acno = Null;

balance = Null;

}

void start();

void deposit();

void withdraw();

void display_accdetails();

};

void bank :: start()

{

cout<<"Enter required details ";

cout<<"Depositor name : ";

cin.get(name);

cout<<"Enter the Account Number : ";

cin>>accno;

cout<<"Enter the Account Type :-";

cin>>account_type;

cout<<"Deposit Amount: ";

cin >>balance;

}

void bank :: deposit()

{

float extra_amount;

cout <<"Depositing";

cout<<"Enter the amount to deposit : ";

cin>>extra_amount;

balance+=balance+extra_amount;

}

void bank :: withdraw()

{

float amount;

cout<<"Withdrwal the amount whtever you needed";

cout<<"Enter the amount to withdraw : ";

cin>>amount;

balance-=balance-amount;

}

void bank :: display_accdetails()

{

cout<<" display Account Details";

cout<<"\nName of the depositor is : "<

cout<<"\nAccount Number is : "<

cout<<"\nAccount Type is : "<

cout<<"\nBalance is : "<

}

int main()

{bank ab;

int choice =1;

while (choice != 0 )

{

cout<<"Enter 5 to exit"

<<"\n1. Create account."<<"\n2. Deposit money"<<"\n3.Withdraw money"<<"\n4.See Account Status";

cin>>choice;

switch(choice)

{

case 1 : ab.start();

break;

case 2: ab.deposit();

break;

case 3 : ab.withdraw();

break;

case 4: ab.display_accdetails();

break;

case 5 :ab.Exit

break;

default: cout<<"\nMatch Not Found";

}

}

return 0;

}

Add a comment
Know the answer?
Add Answer to:
C++ Design a class bankAccount that defines a bank account as an ADT and implements the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money...

    C++ Banks offer various types of accounts, such as savings, checking, certificate of deposits, and money market, to attract customers as well as meet their specific needs. Two of the most commonly used accounts are savings and checking. Each of these accounts has various options. For example, you may have a savings account that requires no minimum balance but has a lower interest rate. Similarly, you may have a checking account that limits the number of checks you may write....

  • Define the class bankAccount to implement the basic properties of a bank account. An object of...

    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member functions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also, declare an array of 10 components of type bankAccount to process up...

  • c++ please    Define the class bankAccount to implement the basic properties of a bank account....

    c++ please    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member func- tions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also declare an array of 10 compo- nents of...

  • C++ Please create the class named BankAccount with the following properties below: // The BankAccount class...

    C++ Please create the class named BankAccount with the following properties below: // The BankAccount class sets up a clients account (name & ID), keeps track of a user's available balance. // It also keeps track of how many transactions (deposits and/or withdrawals) are made. public class BankAccount { Private String name private String id; private double balance; private int numTransactions; // Please define method definitions for Accessors and Mutator functions below Private member variables string getName(); // No set...

  • C++ Help. PLEASE include detailed comments and explanations. PLEASE follow the drections exactly. Thank you. Define...

    C++ Help. PLEASE include detailed comments and explanations. PLEASE follow the drections exactly. Thank you. Define a class with the name BankAccount and the following members: Data Members: accountBalance: balance held in the account interestRate: annual interest rate. accountID: unique 3 digit account number assigned to each BankAccount object. Use a static data member to generate this unique account number for each BankAccount count: A static data member to track the count of the number of BankAccount objects created. Member...

  • (C++) How do I develop a polymorphic banking program using an already existing Bank-Account hierarchy? For each account...

    (C++) How do I develop a polymorphic banking program using an already existing Bank-Account hierarchy? For each account in the vector, allow the user to specify an amount of money to withdraw from the Bank-Account using member function debit and an amount of money to deposit into the Bank-Account using member function credit. As you process each Bank-Account, determine its type. If a Bank-Account is a Savings, calculate the amount of interest owed to the Bank-Account using member function calculateInterest,...

  •       C++ -- Vector of Bank Accounts (15 pts) Please help! :( Use csegrid or Clion for...

          C++ -- Vector of Bank Accounts (15 pts) Please help! :( Use csegrid or Clion for this part Add on to the lab12a solution(THIS IS PROVIDED BELOW). You will add an overload operator function to the operator << and a sort function (in functions.h and functions.cpp)    Print out the customer’s name, address, account number and balance using whatever formatting you would like    Sort on account balance (hint: you can overload the < operator and use sort from the...

  • In C++ Write a program that contains a BankAccount class. The BankAccount class should store the...

    In C++ Write a program that contains a BankAccount class. The BankAccount class should store the following attributes: account name account balance Make sure you use the correct access modifiers for the variables. Write get/set methods for all attributes. Write a constructor that takes two parameters. Write a default constructor. Write a method called Deposit(double) that adds the passed in amount to the balance. Write a method called Withdraw(double) that subtracts the passed in amount from the balance. Do not...

  • MAIN OBJECTIVE       Develop a polymorphic banking program using the Account hierarchy created (below). C++ Capture...

    MAIN OBJECTIVE       Develop a polymorphic banking program using the Account hierarchy created (below). C++ Capture an output. polymorphism. Write an application that creates a vector of Account pointers to two SavingsAccount and two CheckingAccountobjects. For each Account in the vector, allow the user to specify an amount of money to withdraw from the Account using member function debit and an amount of money to deposit into the Account using member function credit. As you process each Account, determine its...

  • Design a bank account class named Account that has the following private member variables:

    Need help please!.. C++ programDesign a bank account class named Account that has the following private member variables: accountNumber of type int ownerName of type string balance of type double transactionHistory of type pointer to Transaction structure (structure is defined below) numberTransactions of type int totalNetDeposits of type static double.The totalNetDeposits is the cumulative sum of all deposits (at account creation and at deposits) minus the cumulative sum of all withdrawals. numberAccounts of type static intand the following public member...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT