0% found this document useful (0 votes)
18 views

Lab Manual - Lab 12-Abstract Class & Interface (2)

dttre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Lab Manual - Lab 12-Abstract Class & Interface (2)

dttre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

North South University

Department of Electrical and Computer Engineering


CSE 215L: Programming Language II Lab

Lab – 12: Abstract Class & Interface

Objective:
● To understand abstract class
● To understand interface

Task:
1. Implement the following classes and invoke area(), perimeter() for object of Triangle:

Polygon Triangle extends Polygon

- sideA: double
- numSide: int - sideB: double
/* constructor */ - sideC: double
/* accessor-mutator */
+ area(): double /* constructor */
+ perimeter(): double /* accessor-mutator */
+ area(): double
+ perimeter(): double

2. Implement the following class and invoke discountedPrice():

<<interface>> BestForCustomer
Discountable
- percentage: double
discountedPrice(price: double): double - threshold: double
- discount: double

/* constructor, accessor, mutator */


+ discountedPrice(price: double): double

discountedPrice() from BestForCustomer class will consider both percentage and


threshold discount and give the customer the best possible sales price.

You might also like