Accounts, C/C++ Programming

Write a program to process bank accounts. Create a base class named Account and two derived classes named Savings and Checking. In the base class, use an int AccountNum and a double balance for data members. Also, create an overloaded operator+= function to do deposit and an overloaded operator-= function to do withdraw. The printBalance function is created to print both savings and checking accounts. The account number of new account is automatically generated by the program beginning at account number one.

here is what I have started

#include
#include
#include

using namespace std;

int main()
{
vector < Checking * > checking(50);
vector < Savings * > savings(50);
int accNumS = 0, accNumC=0;
double bal = 0, amt = 0
int choice

do{
cout<<"Enter one of the following:";
cout<<"1) Create a new Checking Account";
cout<<"2) Create a new Savings Account";
cout<<"3) Make a Deposit for Checking Accoutn(s)";
cout<<"4) Make a Withdrawl for Checking Account(s)";
cout<<"5) Make a Deposit for Savings Account(s)";
cout<<"6) Make a Withdrawl for Savings Account(s)";
cout<<"7) Display all Accounts";
cout<<"8) Exit";
cout<<"Enter Choice: ";
cin>>choice;
}
switch(choice){

case 1:
cout<<"Enter Balance for Account # "< cin >> bal;
checking[accNumC] = new Checking(accNumC+1, bal);
break

case 2:
cout<<"Enter Balance for Account # "< cin >> bal;
savings(accNumS) = new Savings(accNumS+1, bal);
break

case 3:
cout << "Which Checking Account: ";
cin >> acct;
cout <<"Amount of Deposit: ";
cin >> amt ;
(*checking [acct-1]) += amt;
break

case 4:
cout << "Which Checking Account"
cin >> acct;
cout <<"Amount of Withdrawl: "
cin >> amt;
(*savings[acct-1]) -= amt;
break

case 5:
cout << "Which Savings Account: ";
cin >> acct;
cout <<"Amount of Deposit: ";
cin >> amt ;
(*savings [acct-1]) += amt;
break

case 6:
cout <<"Which Savings Account"
cin >> acct;
cout <<"Amount of Withdrawl: ";
cin >> amt ;
(*savings [acct-1]) -= amt;
break

case 7:
Account::print;
break

case 8:
break;

default:cout<"Invalid choice";
break;
}
while(choice != 8);

}
Posted Date: 11/16/2012 7:18:16 AM | Location : United States







Related Discussions:- Accounts, Assignment Help, Ask Question on Accounts, Get Answer, Expert's Help, Accounts Discussions

Write discussion on Accounts
Your posts are moderated
Related Questions
push and pop operation using array draw flowcharts

Define Four Facilities Provided by C Language Preprocessor? The C language preprocessor provides four separate facilities that you can use as you see fit:   Inclusion

Virtual Base Classes This ambiguity can be resolved if the class derived have only one copy of the class base. This can be done by making the base class a virtual class. This k

Classes and Objects A class is a vehicle to execute the OOP features in the C++ language. Once a class is declared, an object of that type can be explained. An object is said t

A: No. If they're utilized properly, they increase encapsulation. You frequently require splitting a class in half while the two halves will have distinct numbers of instances o

Program to convert fraction to decimal: int main() {                 float num, denom;     // numerator and denominator of fraction                 float value;

Task 1 Demonstrate a Java client and server exchanging one text message in each direction. Task 2 Demonstrate a C client and server exchanging one text message in each

Write an algorithm for multiplication of two sparse matrices using Linked Lists.

Static Member Functions All the objects of the class share static data members of a class. The example above demonstrates how to keep track of all the objects of a class which

Implement a menu driven real estate catalogue system that allows users to perform various catalogue maintenance and search tasks.  You are only allowed to use the C programming la