Documente Academic
Documente Profesional
Documente Cultură
02
Semester: Fall 2014
CS304: Object Oriented Programming
Total Marks: 20
Due Date: 08/12/2014
Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your
assignment will not get any credit if:
The assignment is submitted after due date.
The submitted assignment does not open or file is corrupt.
Assignment is copied(partial or full) from any source (websites, forums, students, etc)
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will
be awarded with zero marks. For example, if you submit code in .doc (Microsoft Word Document) or .txt files
or .exe file, no reward will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
Guidelines:
Assignment
Problem Statement:
In this assignment you will be modeling a part of simple banking system. In this system, there are two classes,
Customer and Account which are related to each other via aggregation relationship.
Account No.
Current Balance
Bank name
Branch code
deposit(float)
getBalance()
getAccountNo()
getBankName()
getBrachCode()
Description
Default constructor for account class, setting account balance to 0,
Account number to 1, branch name to NULL and branch code to 0
It will take balance, account no, bank name and branch code as
arguments and set their values accordingly
This will subtract amount from the balance of account that will be
passed as its parameter.
If the amount being withdrawn is greater the balance of the account
, it will display the message Insufficient balance
Function will add amount to the balance of account. Amount will
be passed as its parameter.
This function will return the value of available balance
This function will return the account number
This function will return the name of bank
This function will return branch code of bank
Customer Name
Address
Account object
Description
This function will display the values of all data members
of Customer and Account class
It will take Account, name and address as a arguments and
set their values accordingly
Within main() function, objects of both classes will be created , and respective member functions of these objects
will be called.
First of all create an object of Account class by passing balance, account number, bank name and branch code.
Then create an object of customer class by passing Account object, name and address. Now call display() function
which will display all the values of Customer including his/her name, address and account detail.
The program should prompt the user to enter a value and call deposit() function passing it entered value. Then call
the display() function.
After this, the program should prompt the user to enter a value and call withdraw() function passing it entered
value. Then call the display() function.
Sample output of the program:
BEST OF LUCK!