Question: Question 4: Given the following class: public abstract class Cake1 { protected String name; protected double rate; public Cake1 (String n, double r) { name

Question 4: Given the following class: public abstract class Cake1 { protected String name; protected double rate; public Cake1 (String n, double r) { name = n; rate=) public abstract double calcPricel); public String toString() { return String.format("%s %f" name, rate); }} a) Based on class Cakel and the following table, define TWO (2) subclasses named as orderCakel and readymadeCakel. OrderCakel ReadymadeCakel Additional attribute weight(kg) quantity Price calculation rate*weight rate* quantity b) By using classes definition from a), write an application program that will: D) declare an array of 4 cake objects (both order and readymade); ii) input data for cake objects and store them into the array: 111) display the total price for all types of cakes; iv) display the total price and the quantity sold for readymade cakes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
