Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
39 views

Assignment OOP Lab

This document contains an assignment for a class on object-oriented programming (OOP) lab. It includes two questions to create classes for a bank account and date. For question 1, students are asked to create an ACCOUNT class to represent a bank account with functions like deposit, withdraw, and calculate interest. They must also add overloaded constructors. For question 2, students must create a Date class with functions to add days, months, or years and check for leap years. They must also add constructors to the Date class. The assignment is worth 30 total marks and is due on April 24, 2020.

Uploaded by

student ww
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Assignment OOP Lab

This document contains an assignment for a class on object-oriented programming (OOP) lab. It includes two questions to create classes for a bank account and date. For question 1, students are asked to create an ACCOUNT class to represent a bank account with functions like deposit, withdraw, and calculate interest. They must also add overloaded constructors. For question 2, students must create a Date class with functions to add days, months, or years and check for leap years. They must also add constructors to the Date class. The assignment is worth 30 total marks and is due on April 24, 2020.

Uploaded by

student ww
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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