//ADAM HOLLINGSWORTH
//Subclass Auto derived from SuperClass
public final class SubHealth extends Insurance //superclass
{
private
int coverageGroup, healthPlan;
private
double premium;
//Constructor
for class Auto
public
SubHealth(String ClientName, int ClientAge,
int
ClientSex, int numberOnPolicy, int policytype)
{
//call super
class constructor
super(ClientName,
ClientAge, ClientSex);
//other
variables have their values set in the following methods
setnumPolicy(numberOnPolicy);
sethealthPlan(policytype);
}
public void setnumPolicy(int numPolicy)
{
coverageGroup
= numPolicy;
}
public void sethealthPlan(int policytype)
{
healthPlan =
policytype;
}
public int getnumPolicy()
{
return
coverageGroup;
}
public int gethealthPlan()
{
return
healthPlan;
}
public double premiumBill()
{
if(coverageGroup == 1)
{
if(healthPlan ==
0)
premium =
2300;
else
premium = 1200;
}
else
{
if(healthPlan ==
0)
premium =
2000;
else
premium =
1000;
}
super.setPremium(premium);
return premium;
}
}