19CS1203 - OBJECT ORIENTED PROGRAMMING
CO: 1
PART - A
Develop a Class Triangle with static variables a, b, c which
represent the sides of the triangle and
static methods getArea() and getPerimeter() which takes the
1 a. sides of the triangle as arguments 10 Marks
and return the area and perimeter respectively. And draw the
class diagram. Hint: Area = sqrt(s*
(s-a) * (s-b) * (s-c)) where, s = (a+b+c)/2
(or)
Develop a class Book with private attributes ISBN (long), Title
(String), Price (double) Year
1 b. (int), getter and setter methods. And also draw a class diagram 10 Marks
for the above class.
PART - B
Create a class Vehicle with method noOfWheeels(): int.
The Bicycle class inherits the Vehicle
class and overrides the inherited method. Create a
2.a 15 Marks
reference for Vehicle class and an object for
Bicycle class and access the overridden method
noOfWheeels().
(or)
Explain the differences between method overloading and
2.b method overriding with appropriate examples. 15 Marks