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
Today you will be researching three forms of technology.
Mamont248 [21]

Answer:

why

Explanation:

4 0
3 years ago
Please help!
MaRussiya [10]
Use Easybib.com for your citations. All you have to do is type the name of your sources in to "easybib" and choose if it is a book or a website, then copy it on to a word document.

I hope you can understand this and it helps!!
4 0
3 years ago
Multimedia computer system required the following hardware component they are what​
Lady bird [3.3K]
To develop the system of multimedia we use the various hardware/softwarecomponents are:

The CPU: The CPU, which

is recommended for a multimedia computer should be Pentium IV or other advanced chips. The Monitor: The multimedia PC should be equipped with a monitorhaving Super

Video Graphics Arrays (SVGA) card.

Mark me as brainliest please
3 0
2 years ago
What are some other ways to program a robot to navigate a complicated environment other than straight paths and right angle (90
In-s [12.5K]

Answer:

The most popular method of robot programming is probably the teach pendant. ... To program the robot, the operator moves it from point-to-point, using the buttons on the pendant to move it around and save each position individually. When the whole program has been learned, the robot can play back the points at full speed.

8 0
3 years ago
Read 2 more answers
Mr. Lee wants to show his class a presentation. Which device will display an enlarged view of his presentation?
Gnesinka [82]
A projector would make his presentation bigger.<span />
3 0
3 years ago
Other questions:
  • Trevor got home from work and suddenly realized that he needed to edit a certain file stored in the company network's server. ho
    11·1 answer
  • How can i appear offline without fb messenger saying "last active 1 minute ago"?
    5·1 answer
  • The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
    13·1 answer
  • A law office has been leasing dark fiber from a local telecommunications company to connect a remote office to company headquart
    14·1 answer
  • What is the maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol? Why?
    11·2 answers
  • Suppose you are given a bag containing n unbiased coins. You are told that n − 1 of these coins are normal, with heads on one si
    7·1 answer
  • Which of these is most closely associated with system control? (1 point) (Points : 1.5) boundary
    10·1 answer
  • Using these Web sites for guidance, write a definition in your own words for five of the terms listed below.
    8·1 answer
  • Which term refers to the use of the internet at work for personal use?.
    12·1 answer
  • Content area a leased asset will appear on the balance sheet as a long-term asset. true false'
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!