The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current calendar year. The premium is computed by taking the decade of the customer’s age, adding 15 to it, and multiplying by 20. For example, a 34-year-old would pay $360, which is calculated by adding the decades (3) to 15, and then multiplying by 20. Write an application that prompts a user for the current year and a birth year. Pass both to a method that calculates and returns the premium amount, and then display the returned amount.
Save the class as Insurance.java. Don’t forget to create the application/project InsuranceTest.java Class that has the main method and an object to use the Insurance class.
1
Expert's answer
2017-02-08T07:17:35-0500
public class Insurance { private int currentYear; private int birthClient; private int premiumAmount;
public Insurance(int birthClient, int currentYear) { this.birthClient = birthClient; this.currentYear = currentYear; }
public int getCurrentYear() { return currentYear; }
public int getPremiumAmount() { return premiumAmount; }
public void setCurrentYear(int currentYear) { this.currentYear = currentYear; }
public int getBirthClient() { return birthClient; }
public void setBirthClient(int birthClient) { this.birthClient = birthClient; }
Comments
Leave a comment