Answered step by step
Verified Expert Solution
Link Copied!

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:
a)prepareTea()- a method that prepares a basic tea with hot water and tea leaves.
b)addMilk()- a method that adds milk to the basic tea.
c)addSugar()- a method that adds sugar to the basic tea.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions