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
In black and white,<br><br> we must be more conscious of image
scZoUnD [109]

is it true or false is so it is false

3 0
3 years ago
Give 5 examples for software ​
yuradex [85]

Answer:

  • Adobe Photoshop.

  • Picasa.

  • VLC Media Player.

  • Windows Media Player.

  • Windows Movie Maker

3 0
3 years ago
Alexis plans to stop trading once she lose 5% of her account balance, her account balance is $215.00. How much money is she will
irina1246 [14]

Answer:

She's willing to lose $10.75.

Explanation:

$215.00 * .05 = answer

         or

$215.00 * .95 = x

$215.00 - x = answer

7 0
2 years ago
In what ways can information be slanted in a news report?
ratelena [41]

Answer:It all depends on who the reader is likely to be and the information they’ll want.

Explanation:

Newspaper 1: Company wins contract

Newspaper 2: Previous company loses contract (equally true)

Newspaper 3, say a student paper in the local town: Prospects for new jobs open up as company wins contract.

8 0
1 year ago
I am trying to code a lifting simulator game on ro-blox. These problems listed in the third picture tells you the problems. If y
ipn [44]

Answer:

cool

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • Jesse purchases a new smartphone and is immediately able to use it to send a photo over the Internet to a friend who lives in a
    12·1 answer
  • How long can a lightning last
    13·1 answer
  • What are two most common types of microcomputers? a. IBM-style PCs and Macs c. Clients and Servers b. Mainframes and Minicompute
    14·1 answer
  • Many businesses use robotic solutions. Which department of the food and beverage industry uses robotic solutions on a large scal
    10·2 answers
  • What's the best strategy for avoiding ATM fe
    14·1 answer
  • What keyboard functions lets you delete words
    15·2 answers
  • What is functionality criteria or alternative word
    8·1 answer
  • 1) SuperFetch is a memory-management technique that a) determines the type of RAM your system requires. b) makes the boot-up tim
    7·1 answer
  • Which requires large computer memory?
    15·1 answer
  • What feature should you enable to prevent the sidhistory attribute from being used to falsely gain administrative privileges in
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!