4. The Litsemba Life Insurance company computes annual policy premiums based on the age the customer turns in the calendar year. The premium is computed by taking the decade of the customer's age, adding 15 to it, and multiplying by 20. Write a Java application that prompts the user for the current year and birth year. Pass both to method that calculates and returns the premium amount and display the returned amount. Application should be saved as Insurance.java . Note: the customer age should not be more than 59 years. [10 Marks]
let age = 34;
if (age > 59) {
console.log('Incorrect age!');
} else {
let extra = (parseInt(age / 10) + 15) * 20;
console.log('Value is ' + extra);
}
Comments
Leave a comment