Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!