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
Which of the following does NOT help a user navigate through a document?
FromTheMoon [43]

Answer:

Navigation Tabs

Explanation:

Navigation tab is used to switch between different pages that are shown in navigation tab. It is not used to navigate through the document.

Scroll bar is used to navigate through the document line by line. It has been shown on the right side of the document to move up and down the page.

Next page and previous page button used to navigate between pages of the documents.

7 0
3 years ago
Matt goes to an Internet café and tries to access his emails. The email client asks Matt to enter his email address along with t
Radda [10]

Answer:

acknowledging

Explanation:

it has to be d

6 0
3 years ago
It can store 5 times more data <br>than DVD and has scratch<br>resistance property.​
pav-90 [236]
Is this the full question?
7 0
3 years ago
Software built and delivered in pieces is known as
mafiozo [28]

Answer:

Incremental technique is the way in which software is built and delivered in pieces. The concept is to keep the client and developer on same page and the client is known as a non tech person, so he should be given software in piece by piece to avoid any confusion and sudden change.

Agile method is the best example of this technique in which steps are defined on contract basis and the software is delivered and build by pieces to keep client and developer on same page.

8 0
3 years ago
Read 2 more answers
Software that interprets commands from the keyboard and mouse is also known as the
Stells [14]
A) operating system
It is going to let you "operate" it using the mouse and keyboard
4 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What
    15·1 answer
  • 5. How is shutter speed generally measured? What do the measurements mean?
    7·2 answers
  • Which of the following things would you access from the Program &amp; Courses page? Course descriptions Tutorial videos Account
    7·1 answer
  • An information- and communication-based electronic exchange environment mostly occupied by sophisticated computer and telecommun
    13·1 answer
  • Communications technology and the Internet can be used to reduce the time and costs involved in disseminating financial statemen
    14·1 answer
  • Witch of the following is a valid why a scientist might a scientific theory
    13·1 answer
  • Which of these is a requirement for developing game applications on devices running Apple’s iOS operating system?
    6·2 answers
  • You have stumbled on an unknown civilization while sailing around the world. The people, who call themselves Zebronians, do math
    11·1 answer
  • QUESTION 4 of 10: True or False: According to the reading, investors care about your love for your business.
    5·2 answers
  • What programming language supports relational databases?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!