Question 2:
Question 2 (3 marks)
-Define a Product class and a SoidStateDrive class extending from Product (i.e. Product is an abstract class and it is a superclass, SoidState Drive is a subclass) with the following information:
Product
Where:
-name:String
Product() - default constructor
-brand:String
3 of 4
Paper No: 1
+Product()
+Product(name:String, brand: String)
+ getName():String
+ getBrand():String
+ getFinal Price(): double
+ getTotalAmount (): double
Product(name: String, brand: String) - parameterized constructor, which sets values to name and brand.
getName(): String - return the name
getBrand(): String - return the brand
getFinalPrice(): double the abstract method will be implemented in a subclass
getTotalAmount(): double - the abstract method will be implemented in a subclass
-Write a class named the SoidStateDrive (in the default package) extending from the Product class with the following information:
Close
+ 100%
Zoom