Exam Questions Set 1 CSC2106 Object-Oriented Design & Programming
Exam Questions Set 1 CSC2106 Object-Oriented Design & Programming
Hints: Set the content-pane to 4x2 GridLayout. The components are added from left-to-right,
top-to-bottom.
Section C: MySQL connection and SWING
(6 pts) To connect to mysql database using java programming, we must include a library.
What is the name of the library and explain how you include it in your project.
(a) Class Car is an abstract class. Explain the role of an abstract class. [1 marks]
(b) Write a Java version of class Car assuming it has this constructor:
public Car(double price, int year)
and that the method calculateSalePrice ( ) is abstract. [3 marks]
(c) Write a Java version of class ClassicCar assuming it has this constructor:
public ClassicCar (double price, int year) [2 marks]
and that the method calculateSalePrice ( ) returns 10,000 as the sale price of the car.