In: Computer Science
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 customre'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 then display the returned amount. Save the application as Insurance,java.
below i have written the Java program as per the requirement.
===============================================================
Please note that the below program is tested on ubuntu 14.04 sytem and compiled in javac compiler. This program will also work on other IDE's.
Program:
================================================================
import java.util.Scanner;
public class Insurance
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("Enter the Age: ");
int age = in.nextInt();
int decade = age/10;
double premium = (decade + 15) * 20;
System.out.println("The return amount is $"+premium);
}
}
=================================================================
Output: