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

19Cs1203 - Object Oriented Programming: 10 Marks

The document describes two programming assignments involving object-oriented concepts in Java. The first part involves creating a Triangle class with static methods to calculate area and perimeter based on side lengths, and a Book class with private attributes and getter/setter methods. The second part involves creating a Vehicle class with a method to return number of wheels, and having a Bicycle class inherit and override this method, as well as explaining the differences between method overloading and overriding with examples.

Uploaded by

Avinash Alla
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)
82 views1 page

19Cs1203 - Object Oriented Programming: 10 Marks

The document describes two programming assignments involving object-oriented concepts in Java. The first part involves creating a Triangle class with static methods to calculate area and perimeter based on side lengths, and a Book class with private attributes and getter/setter methods. The second part involves creating a Vehicle class with a method to return number of wheels, and having a Bicycle class inherit and override this method, as well as explaining the differences between method overloading and overriding with examples.

Uploaded by

Avinash Alla
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

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

You might also like