Question
***can you write this program in java*** public abstract class Policy { protected static final int CURRENT_YEAR = 2018; private int policyStartDate; private double yearlyPremiumAmount;
***can you write this program in java***
public abstract class Policy {
protected static final int CURRENT_YEAR = 2018;
private int policyStartDate;
private double yearlyPremiumAmount;
public Policy(){
policyStartDate = 0;
yearlyPremiumAmount = 0.0;
}
public void setPolicyStartDate(int pDate) {
policyStartDate = pDate;
}
public void setYearlyPremiumAmount(double pAmount) {
yearlyPremiumAmount = pAmount;
}
public int getPolicyStartDate() {
return policyStartDate;
}
public double getYearlyPremium() {
return yearlyPremiumAmount;
}
public abstract void addCustomerInfo(String n, String a, String c, String s);
public void PrintData() {
System.out.println("The year is currently: " + CURRENT_YEAR);
System.out.println("The year the policy was start: " + policyStartDate);
System.out.println("The premium for this policy for the entire year is: " + yearlyPremiumAmount);
}
public double calcMonthlyPremium(){
return yearlyPremiumAmount / 12;
}
}
public interface PolicyNumber {
public abstract void genPolicyNumber();
}
Lizard, an insurance company, sells the following types of insurance: Boat Insurance and Motorcycle Insurance You will create a Java inheritance hierarchy representing the above with the classes below -Customer has the attributes of a name, address, city, and state Policy has a constant CURRENT YEAR (this year),a start date for the policy, and a have to be assigned values Put this in your project! changes to this class. PolicyNumber is an interface with one method and is yearly premium amount (these last two variables will by the child classes). *This class is provided for you. You will use it as the parent class. DO NOT make provided for you. Put this in your project! It must be implemented by the below Insurance classes, DO NOT make changes to this class. Child classes: BoatInsurance have class attributes of a policy number (this will be generated using a combination of numbers and letters), boat type (power or sail), a class, make, a length, year, and a Customer object MotorcycleInsurance have class attributes of a policy number (this will be generated identification number make, model, year, bodystyle using a combination of numbers and letters), a vehicle (can be just numbers or both numbers and letters) (street, cruiser, sport, etc.), and a Customer object. Your DriverP3 will have an array of Policy objects. All of your data is to be hard-coded child classes. In addition to the standard constructors, accessors and here and passed to the appropriate methods in the mutators, Customer should have a toString. Your child classes: Should complete the Interfaces method to generate a policy number by: Lizard, an insurance company, sells the following types of insurance: Boat Insurance and Motorcycle Insurance You will create a Java inheritance hierarchy representing the above with the classes below -Customer has the attributes of a name, address, city, and state Policy has a constant CURRENT YEAR (this year),a start date for the policy, and a have to be assigned values Put this in your project! changes to this class. PolicyNumber is an interface with one method and is yearly premium amount (these last two variables will by the child classes). *This class is provided for you. You will use it as the parent class. DO NOT make provided for you. Put this in your project! It must be implemented by the below Insurance classes, DO NOT make changes to this class. Child classes: BoatInsurance have class attributes of a policy number (this will be generated using a combination of numbers and letters), boat type (power or sail), a class, make, a length, year, and a Customer object MotorcycleInsurance have class attributes of a policy number (this will be generated identification number make, model, year, bodystyle using a combination of numbers and letters), a vehicle (can be just numbers or both numbers and letters) (street, cruiser, sport, etc.), and a Customer object. Your DriverP3 will have an array of Policy objects. All of your data is to be hard-coded child classes. In addition to the standard constructors, accessors and here and passed to the appropriate methods in the mutators, Customer should have a toString. Your child classes: Should complete the Interfaces method to generate a policy number byStep 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