Assignment OOP Lab

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Army Public College of Management & Sciences

University of Engineering &Technology – Taxila


Khadim Hussain Road, Rawalpindi

Assignment
Submitted by: Wardah Saleem
Roll no: F-101032

Subject: OOP(Lab) Due date: 24/04/2020


Name of Faculty: Engr. Beenish Asim Max Marks: 30
Class: BSSE-1

Question 1:
a) Write a class ACCOUNT that represents your bank account including Name of the
account holder, Account number, Type of account, Balance amount in the account.
The class should allow you to deposit money, withdraw money, calculate interest,
send you a nasty message if you go overdrawn etc.
b) Further modify the class ACCOUNT to use overloaded constructors. One could set
the account balance to zero and another could set it to a given value.
c) In the main program create two instances of the ACCOUNT class on which you
can perform all the functions related with the account. [Marks 15]
Output:
Question 2:
a) Define class Date which will provide operations like adding day, month or year to
existing date. Also provide function to check for the leap year.

b) Modify your Date class to add constructors. They should use the constructors to set
the values of the day, month, and year. One could set the day, month, and year to
current day, month, and year and another could set it to a given value.
c) In the main program create two instances of the Date class and check whether the
year specified by the user is a leap year.

Note: you can check the leap year for both 2 digit and 4 digit formats by using the
following code.
if( (year%400==0 || year%100!=0) &&(year%4==0))
cout<<"It is a leap year";
else
cout<<"It is not a leap year";
[Marks 15]
Output:

________________________________________________

You might also like