get TotalAmount(): 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:
SoidState Drive
-code: String
-speed:int
-quantity:int
-price:double
+ SoidState Drive ()
+ SoidState Drive (code: String,speed:int, quantity:int, price:double, name: String, brand:String)
+setters & getters
+toString(): String
+getFinalPrice():double
+getTotalAmount(): double
Where:
SoidStateDrive() - default constructor
SoidStateDrive (code: String, speed: int, quantity:int, price: double, name: String, brand: String) - parameterized constructor, which sets values to code, speed, quantity, price, name, and brand.
setters & getters (): write all setters and getters of
the fields toString(): String returns information of a
SoidStateDrive such as code, name, brand, speed,price. The price is formatted to two decimal places
getFinal Price():double - returns final price with final price is calculated by the following formula::
o if speed<=1024 then final price = price 20% off
o if 1024 < speed <=2048 then final price = price 10% off
o if speed>2048 then final price=price 5% off getTotalAmount(): double return the total amount with total amount= quantity* final price
-The Main class is provided for you in binary form. You only test your program by running the binary file. There are several test cases for you, as follows:
Enter code:1
Enter code:1
Enter code:1
Enter speed:1024
Enter speed:1024
Enter speed:1024
Enter quantity:5
Enter quantity:5
Enter quantity:5
Enter price:23.134
Enter price:100
Enter price: 100
Enter name:Evo
Enter name: Evo
Enter name:Evo
Zoom
Close
+ 100%