Define superclass Food that has the following specifications:
private instance variables:
- name which is the food name of type String.
public methods:
- full-argument constructor to initialize the instantiated objects.
- toString() to return food data.
Define subclass SeaFood that inherits the class Food and has the following specifications:
private instance variables:
- pricePerKilo which is the price per kilo of type double.
- quantity which is the quantity in kilos of type int.
public methods:
- full-argument constructor (receives three paramers: name, price and quantity)
- toString() to return food data and seafood data.
- main method that create an array of three objects of type SeaFood. Fill them with data. Print data of all seafood objects and their total price [Total is computed as summation of price×quantity for all objects].
Sample of output:
Name: Shrimp, Price/kg: 60.0 SAR, Quantity: 4 kg
Name: Salmon, Price/kg: 50.0 SAR, Quantity: 5 kg
Name: Tuna, Price/kg: 30.0 SAR, Quantity: 2 kg
Total price: 550.0 SAR