Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement polymorphism in your program by creating an array of Tea objects that includes instances of the Tea class and its subclasses. Create three subclasses
Implement polymorphism in your program by creating an array of Tea objects that
includes instances of the Tea class and its subclasses.
Create three subclasses of the Tea class: BlackTea, GreenTea, and HerbalTea. Each
subclass should override the prepareTea method to prepare the specific type of tea
black tea, green tea, or herbal tea with appropriate ingredients and brewing times.
Create a Tea class in Java that includes the following methods:
aprepareTea a method that prepares a basic tea with hot water and tea leaves.
baddMilk a method that adds milk to the basic tea.
caddSugar a method that adds sugar to the basic tea.
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