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
Wich command converts a number to a string​
AfilCa [17]

Answer:

okay yes i agree

Explanation:

8 0
3 years ago
What is the dividend rate for ibm stock?
Vaselesa [24]
3.28% I think 
......................................................................................................................................
5 0
3 years ago
To navigate through your presentation slides, which key on your keyboard can you use?<br> Dankonace
jekas [21]

Answer:

You use your arrow keys

Explanation:

4 0
3 years ago
Data silos are often associated with ________________.
amid [387]

Answer:

Option b the development of one or a few related analytics applications.

Explanation:

Data silo is the isolated information in an organization which is not shared across different departments. Data silo could exist because one department in an organization may not see the necessity to share information to other department. Or the information is deemed as unique data which is dedicated  to develop one or a few very specific analytics applications.  Data silos should be minimized if an organization intends to develop a data analytics system that support in enterprise wide level.

7 0
3 years ago
Measurement consists of:__________
Naddik [55]

Answer:

The answer is choice "a".

Explanation:

Measurement is a number allocation in which the entity or event attributes that would be comparable with other objects or events. Its scope and implementation depending on context and discipline.  

  • Its main purposes could be defined as measurements for efficiency, tracking, health, fitness (design, mounting), and solving problems.  
  • Its calculation consists of the numerical assignment, representing attribute amounts according to the rules for objects and events.
3 0
3 years ago
Other questions:
  • Consider a set of mobile computing clients in a certain town who each
    13·1 answer
  • Write the definition of a method min that has two int parameters and returns the smaller.
    9·1 answer
  • python Write a program that will take a file named Celsius.dat that contains a list of temperatures in Celsius (one per line), a
    9·1 answer
  • Chuck plans to go on a hiking trip. Before the hiking trip, Chuck's bank account has $129.50. He then spends $129.50 on hiking g
    6·1 answer
  • Does anybody know how to unlock websites from school computer
    7·1 answer
  • Can anyone help me this is due today :) <br> Thank you so much
    14·2 answers
  • Which are examples of types of audio media that can support a presentation? Check all that apply.
    14·2 answers
  • Write a python program that should determine from the range you choose to enter :
    9·1 answer
  • KDS Company has 3 departments: 1. Dept X 2. Dept Y 3. Dept Z. Design a program that will read as input each department's sales f
    6·1 answer
  • An opening inside the system unit in which you can install additional equipment can be known as
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!