Lab Assignment-2
Lab Assignment-2
A class 'Box' which contains method and other details(width, height, depth) to calculate
volume.
Another class ‘Boxweight’ contains method for finding cost for shipping the box using
weight of the box (formula to find cost of shipping= distance in km * volume * cost per
km)
WAP to find the volume of box and cost to ship using a single object
Q2
WAP to create a method to create a method named 'multiply' and overload it such that-
Use cases-
(1)
(2)
(For 2 parameters)
(3)
(For 3 parameters)
Shape is the super class for square and rectangle. Write a program to find areas of
square and rectangle by inheriting shape.
Q4
Design a interface "Car" containing abstract methods- start(), stop() and running() along
with few member variables. Define another class "Toyota" which implements the
interface and use those methods as its own.
Q5
Its subclass 'circle' also has method 'about' but different body.
Is it possible to create a object of circle but give its reference as shape? Demonstrate via
example and provide suitable output.