0% found this document useful (0 votes)
84 views5 pages

OOP Lab-12 & 13 Task

The document describes two tasks related to object oriented programming in C++. Task 1 involves creating an Account class with methods to credit, debit and print account details. Task 2 involves creating a product hierarchy with classes for products, electronics and subclasses for MP3 players and TVs with attributes like price, discount, manufacturer, color/capacity and size respectively, and classes for books with attributes for name and author.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views5 pages

OOP Lab-12 & 13 Task

The document describes two tasks related to object oriented programming in C++. Task 1 involves creating an Account class with methods to credit, debit and print account details. Task 2 involves creating a product hierarchy with classes for products, electronics and subclasses for MP3 players and TVs with attributes like price, discount, manufacturer, color/capacity and size respectively, and classes for books with attributes for name and author.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

FAST

‫الذی علم بالقلم۔ علم االنسان ما لم يعلم۔‬

National University of Computer and Emerging Sciences


DEPARMENT OF COMPUTER SCIENCE

Object Oriented Programming-Lab


Lab 12 & 13 – Tasks(Home Work)
LAB 12 & 13 – TASKS
(HOME WORK)
Due Date: 19-Jun-2021
 No late submissions will be entertained.
 All submissions should be made on Google Class Room.
 Emailed assignment will be marked as 0.
 An individual/group may be assigned a straight-
forward 0 if the submitted assessed Home work is
copied/cheated from another individual/group.
 Upload PDF File including all tasks code and output
respectively.

Engr. Khuram Shahzad


(Instructor)
2
Task-01

A class called Account, which models a bank account, is


designed as shown in the class diagram. It contains:
Two private data members: accountNumber (int)
and balance (double), which maintains the current account
balance.
Public functions credit() and debit(), which adds or subtracts the
given amount from the balance, respectively.
The debit() function shall print "amount withdrawn exceeds the
current balance!" if amount is more than balance.
A public function print(), which shall print "A/C no: xxx
Balance=xxx" (e.g., A/C no: 991234 Balance=$88.88),
with balance rounded to two decimal places.
Use the following main().

3
Task-02
We want to store some details about an online
shop. This shop has several kinds of products.
Each product is represented by a class. The
products are categorized intro Electronics and
Books. The Electronics is further subdivided into
MP3 Player and Television. The hierarchy is
shown below:

For each product, system needs to store its regular price and discount. The system should
provide a functionality to set or get a price for each product. For the products that are
categorized as electronics, the name of the manufacturer should be stored. For MP3Players,
system should store the color and capacity (in Giga Bytes). The system stores the size of
each television. For each book, the following information is needed: Name of the book
and Author‟s name. For each product, the system should calculate its discounted price.
Apply object oriented programming concepts and implement this system in C++.
Implement setter and getter functions for each class and all other required functions. Use
the following main().
4
THANKS

You might also like