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]
4 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]4 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
Convert 105 decimal to 128 binary form
krok68 [10]

Answer:

1101001 is binary 105

128 in binary is 10000000

6 0
2 years ago
Can java scanner not take in a negative input?
algol [13]

Answer:

It can take a negative input

Explanation:

When you declare a variable in Java and you get your input via Scanner library; the Scanner library will accept the input irrespective of whether it's negative or not.

Take for instance, the following segment

<em>Scanner input = new Scanner(System.in);</em>

<em>int userinput = input.nextInt()</em>

<em />

Irrespective of whether userinput is negative or positive, it'll accept it.

8 0
3 years ago
FIRST AMSWER GET BRAINLIEST​
MA_775_DIABLO [31]

Answer:

agile --> business modeling

RAD --> pair programing

waterfall --> deployment

spiral --> risk analysis

v-shaped model --> integration testing

not too sure about this but i tried

4 0
3 years ago
James, a system administrator, is tasked to update the BIOS and firmware of the computer in his organization. What are the reaso
Xelga [282]

Answer:

One reason to update BIOS and firmware is to ensure they support new hardware like CPU model or graphic card. In some cases, the updates can also resolve overheating issue or motherboard issue.  

However, this is not always the case that we must update the BIOS every time there is a new release because the latest update may cause problem to existing system as well.

As a general rule, only when there are some problems with the existing BIOS and firmware, we are only required to update them.

7 0
3 years ago
Why does the PC send out a broadcast ARP prior to sending the first ping request
Norma-Jean [14]

Since the ARP broadcast is utilized to request the MAC address of the Host with the IP address contained in the ARP, the PC needs to know the destination of MAC address before it can produce the frame header for the particular PING requested, before it can send a PING to a host.

5 0
3 years ago
Other questions:
  • Describe the components of series-parallel circuit
    14·1 answer
  • Finding your style in photography is about ___
    10·2 answers
  • Which software fits into the category of a productivity software?
    11·1 answer
  • PHP Create a for loop that initialize with the variable $i = 10 The loop outputs $i as long as $i is greater than 1 using for lo
    9·1 answer
  • What is contrast (in Photography)?
    14·1 answer
  • In ____, data can move in both directions at the same time, such as with a telephone.
    11·1 answer
  • ______ communication channels develop outside the organizational structure and do not follow the chain of command.
    8·2 answers
  • In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
    13·1 answer
  • True or false = the order of cannot be changed in slide shorter view ,true or false =menu bar is located just below the title ba
    8·2 answers
  • What type of platform is SAP?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!