Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Class GetPlanFactory { / / use getPlan method to get object og tupe plan public Plan getPlan ( string planType ) { if ( planType

Class GetPlanFactory
{
// use getPlan method to get object og tupe plan
public Plan getPlan(string planType)
{
if (planType == null)
{
return null;
}
if(planType.equalsIgnoreCase("DOMESTICPLANT))
{
return new DomesticPlan();
}
else if(planType.equalsIgnoreCase(COMMERCIALPLANT))
{
return new CommercialPlan();
}
else if(planType.equalsIgnoreCase(INSTITUTIONALPLAN))
{
return new InstitutionalPlan();
}
retum null;
}
}
Create the following three Concrete classes that extends Plan abstract class.
a) DomesticPlan, InstitutionalPlan, CommercialPlan
b) Each plan returns the rate at which electricity bill can be paid. Such as, for domestioplas is 3.5, for InstitutionalPlan is 5.5 and CommercialPlan is 5.5
Answer:
class DomesticPlan
{

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

Step: 3

blur-text-image

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago