1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
BartSMP [9]
3 years ago
5

The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current cal

endar 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.
Computers and Technology
1 answer:
Ksenya-84 [330]3 years ago
8 0

Answer:

The JAVA program for the scenario is given below.

import java.util.Scanner;

import java.lang.*;

public class Insurance

{

   //static variables to hold mandatory values

   static int age;

   static int premium;

   static int decades;

public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       //user prompted to enter present age

 System.out.print("Enter your age in current year: ");

 age = sc.nextInt();

 //computation to calculate premium amount

 decades = age/10;

 premium = (decades + 15)*20;

 System.out.println("");

 System.out.println("The annual premium to be paid for age "+age+" is $"+ premium);

}

}

OUTPUT

Enter your age in current year: 45

The annual premium to be paid for age 45 is $380

Explanation:

1. The variables are declared with integer datatype to hold customer age, decades and premium.  

2. All the variables are declared static so that they can be accessible inside main() which is a static method.

3. Inside main(), object of Scanner is created, sc.

4. User is asked to enter present age.

5. User input is taken into age using scanner object, sc and nextInt() method.

6. Following this, the decades in customer’s age is computed by dividing age by 10 and assigned to decades variable.

7. Next, annual premium is calculated by adding 15 to decades and then, multiplying the result by 20. The final result is assigned to premium variable.

8. A new line is inserted before printing the annual premium amount.

9. The calculated annual premium amount based on customer’s present age is displayed.

10. The class having main() method is named Insurance. Hence, the program is named as Insurance.java.

11. Only one class is taken in the program since nothing is specifically mentioned about classes in the question.

12. The Insurance class is declared public since execution begins with main() method.

13. If more than one class is present in the Java program, only the class having main() method is declared public; other classes are not declared public.

You might be interested in
Gabe just won the lottery after ten years of consistently buying a ticket every Friday. Based on his initial reaction of feeling
ludmilkaskok [199]
The answer is D. cortisol level would most likely decrease.                                                                                                                                                                             

5 0
4 years ago
Read 2 more answers
Why dont your garage key work after tou put in a garage door opening?
n200080 [17]
Something might be wrong with the key or the key hole its self.
hopefully i helped 0-0 ;p
plz mark brainly
7 0
3 years ago
Time management is all about managing your emotions. <br> True <br> False
Alex777 [14]
I’m pretty sure it’s true
5 0
3 years ago
Read 2 more answers
Research and recommend the most appropriate VPN technology. The most likely solution is either an Internet Protocol Security (IP
chubhunter [2.5K]

Answer:

The five eras are general- purpose mainframe and minicomputer computing, personal computers, client/server networks, ...

7 0
3 years ago
Review Questions
Verdich [7]

Answer:

BASIC is high-level programming. John G. Kemeny and Thomas E. Kurtz  developed BASIC

Explanation:

7 0
3 years ago
Other questions:
  • One reason for using social media is to develop social and professional contacts. True or false?
    9·2 answers
  • What is a basic operation of computers
    13·1 answer
  • A technician is using a network-attached desktop computer with a Type 2 hypervisor to run two VMs. One of the VMs is infected wi
    14·1 answer
  • For each of the following scenarios, write down what feature should be used in
    12·1 answer
  • Jasmine is writing a shopping app. She has created a variable to keep track of the number of items in the shopping cart. Every t
    6·1 answer
  • GIVING 10 or 20 POINTS for brainliest HELP ASAP!! Instructions Click the links to open the resources below. These resources will
    10·1 answer
  • Lydia is trying to take an aerial shot from the window of an airplane. Where should she hold her camera to get the best shot?
    8·1 answer
  • Which pickaxe in minecraft to use?
    14·1 answer
  • Define the term algorithm and describe how programmers use algorithms when designing a program.
    8·1 answer
  • 4) What is a desktop?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!