Question
Given the following class: public abstract class Cake1 { protected String name; protected double rate; public Cake1 (String n, double r) { name = n;
Given the following class:
|
- Based on class Cake1 and the following table, define TWO (2) subclasses named as orderCake1 and readymadeCake1.
OrderCake1 | ReadymadeCake1 | |
Additional attribute | weight(kg) | quantity |
Price calculation | rate*weight | rate*quantity |
|
|
|
- By using classes definition from a), write an application program that will:
i) declare an array of 4 cake objects (both order and readymade); ii) input data for cake objects and store them into the array; iii) 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started