question:
Create a class named Account with data members act_NO and balance. Functions include a constructor that requires the account number and balance parameters, as well as a display function. Derive two classes from Account: Saving which includes an interest rate and Current which includes a service charge. Write main() function to demonstrate the classes.
(Example: from each class, create an account named Gita and Sharmi and show Gita's Current Account balance including her service charge for that year, while for sharmi's Saving Account, shows her balance including interest for that year)
2 replies to this topic
#1
Posted 19 October 2010 - 07:18 AM
|
|
|
#2
Posted 19 October 2010 - 07:39 AM
What do you have so far? Or do you have any questions?
We won't do your homework for you. ;)
We won't do your homework for you. ;)
Sometimes words ain't enough to express something. That's why computer scientists use double words.
#3
Posted 19 October 2010 - 09:03 AM
here some of the coding.. i need your help please...a.s.a.p...tq 4 your help.. appreciate it
#include<iostream.h>
class account
{
protected:
int no_account;
char*name;
public:
account();
void open_account(int no_a,char*n);
void display_account();
};
account::account()
{
no_account=0;
}
void account::open_account(int no_a,char*n)
{
no_account=no_a;
name=n;
}
void account::display_account()
{
cout<<"From class account......"<<endl;
cout<<"Number account : "<<no_account<<endl;
cout<<"Name : "<<name<<endl;
}
class current:public account
{
float balance;
public:
current();
void deposit(float b);
void display_balance();
};
current::current()
{
balance=0;
}
void current::deposit(float b)
{
balance=balance+b;
}
void current::display_balance()
{
cout<<"From account class ...."<<endl;
cout<<"Number account : "<<no_akaun<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Balance : "<<balance<<endl;
}
void main()
{
current C;
C.open_account(111,"Gita");
C.display_account();
C.deposit(1000.00);
C.display_balance();
C.deposit(500.00);
C.display_balance();
}
#include<iostream.h>
class account
{
protected:
int no_account;
char*name;
public:
account();
void open_account(int no_a,char*n);
void display_account();
};
account::account()
{
no_account=0;
}
void account::open_account(int no_a,char*n)
{
no_account=no_a;
name=n;
}
void account::display_account()
{
cout<<"From class account......"<<endl;
cout<<"Number account : "<<no_account<<endl;
cout<<"Name : "<<name<<endl;
}
class current:public account
{
float balance;
public:
current();
void deposit(float b);
void display_balance();
};
current::current()
{
balance=0;
}
void current::deposit(float b)
{
balance=balance+b;
}
void current::display_balance()
{
cout<<"From account class ...."<<endl;
cout<<"Number account : "<<no_akaun<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Balance : "<<balance<<endl;
}
void main()
{
current C;
C.open_account(111,"Gita");
C.display_account();
C.deposit(1000.00);
C.display_balance();
C.deposit(500.00);
C.display_balance();
}
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









