0% found this document useful (0 votes)
130 views1 page

North South University Department of Electrical and Computer Engineering CSE 215L: Programming Language II Lab Lab

This document provides an objective and task for a lab on abstract classes and interfaces in programming language II. The task is to implement shape and rectangle classes with area and perimeter methods, with rectangle extending shape. It also involves implementing a Discountable interface and PercentageDiscount and ThresholdDiscount classes that both have a discountedPrice method.

Uploaded by

Tasfiul Hedayet
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)
130 views1 page

North South University Department of Electrical and Computer Engineering CSE 215L: Programming Language II Lab Lab

This document provides an objective and task for a lab on abstract classes and interfaces in programming language II. The task is to implement shape and rectangle classes with area and perimeter methods, with rectangle extending shape. It also involves implementing a Discountable interface and PercentageDiscount and ThresholdDiscount classes that both have a discountedPrice method.

Uploaded by

Tasfiul Hedayet
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/ 1

North South University

Department of Electrical and Computer Engineering


CSE 215L: Programming Language II Lab

Lab – 11: Abstract Class & Interface


Objective:
● To understand abstract class
● To understand interface

Task:
1. Implement the following classes:

Shape Rectangle extends Shape

- name: String - length: double


- width: double
+ Shape(name: String)
/* accessor-mutator */ + Rectangle(name: String, length:
+ area(): double double, width: double)
+ perimeter(): double /* accessor-mutator */
+ area(): double
+ perimeter(): double

2. Implement the following classes and invoke discountedPrice() for object of each class.
<<interface>>
Discountable

discountedPrice(price: double): double

PercentageDiscount ThresholdDiscount

- percentage: double - threshold: double


- discount: double
+ PercentageDiscount(percentage:
double) + ThresholdDiscount(threshold: double,
+ getPercentage(): double discount: double)
+ setPercentage(percentage: double): + getThreshold(): double
void + getDiscount(): double
+ discountedPrice(price: double): + setThreshold(threshold: double):
double void
+ setDiscount(discount: double): void
+ discountedPrice(price: double):
double

You might also like