Question

I HAVE BEEN UNABLE TO FIND THE JAVA CODE FOR THE SECOND PART OF THE PROBLEM...

I HAVE BEEN UNABLE TO FIND THE JAVA CODE FOR THE SECOND PART OF THE PROBLEM IN BOLD BELOW.

The Harrison Group Life Insurance company computes annual policy premiums based on the age the customer turns in the current calendar year. The premium is computed by taking the decade of the customer’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 a birth year. Pass both to a method that calculates and returns the premium amount, and then display the returned amount.

calculatePremium works for a 92 year old

0 0
Add a comment Improve this question Transcribed image text
Answer #1


import java.util.Scanner;

class Insurance {
public static void main(String[] args) {
System.out.println("Harrison Group Life Insurace Company");

//Scanner class for taking inputs

Scanner s= new Scanner(System.in);

//Taking Birth Year & current year as input

System.out.print("Enter your birth year: ");
int birth_year=s.nextInt();
System.out.print("Enter current year: ");
int cur_year=s.nextInt();

//Passing Birth year and current year to method as parameters

float premium_amount=calculatePremium(birth_year,cur_year);
System.out.println("So respectively your premium amount is $"+premium_amount);
}

//Method for calculating Premium Amount of Customer

static public float calculatePremium(int birth, int curr){

int age;
float decades,prem_amount;

//Calculating age according to given Birth year and current year
age=curr-birth;
System.out.println("Your age is "+age);

//It would calculate decades depending on the age of the customer
//casting to float type Because We have to calculate exact decades
decades= (float) (age/10.0);

//It would add 15 in the decades and multiply it to 20 as specified in the statement
//and return the amount calculated

prem_amount= (decades+15)*20;
return prem_amount;
}
}

COMMENT DOWN FOR ANY QUERIES AND,

LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

atches scratch_4.java Project - 0 $ - scratch_4.java - Scratch C:\Program Files\Java\jdk1.8.0_111\bin\java.exe" ... Harrison Group Life Insurace Company Enter your birth year: 1928 Enter current year: 2020 Your age is 92 So respectively your premium amount is $484.0 → If Process finished with exit code 0

Add a comment
Know the answer?
Add Answer to:
I HAVE BEEN UNABLE TO FIND THE JAVA CODE FOR THE SECOND PART OF THE PROBLEM...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Instructions Comprehensive Problem 2-1 Beverly and Ken Hair have been married for 3 years. Beverly works...

    Instructions Comprehensive Problem 2-1 Beverly and Ken Hair have been married for 3 years. Beverly works as an accountant at Cypress Corporation. Ken is a full-time student at Southwest Missouri State University (SMSU) and also works part-time during the summer at Cypress Corp. Ken's birthdate is January 12, 1993 and Beverly's birthdate is November 4, 1995. Beverly and Ken each received a W-2 form from Cypress Corporation (see separate tab). The Hairs have interest income of $1,000 on City of...

  • Beverly and Ken Hair have been married for 3 years. Beverly works as an accountant at...

    Beverly and Ken Hair have been married for 3 years. Beverly works as an accountant at Cypress Corporation. Ken is a full-time student at Southwest Missouri State University (SMSU) and also works part-time during the summer at Cypress Corp. Ken's birthdate is January 12, 1993 and Beverly's birthdate is November 4, 1995. Beverly and Ken each received a W-2 form from Cypress Corporation (see separate tab). The Hairs have interest income of $1,000 on City of St. Louis bonds. Beverly...

  • Can someone please tell me what chapters (1-5) these questions are based on? I have already answered the questions and u...

    Can someone please tell me what chapters (1-5) these questions are based on? I have already answered the questions and understand how to solve the material, but i want to be able to pinpoint where i can find this info. in the book. I am using Brigham’s Fundamentals of Financial Management (pictures attached). If it is hard to read, please let me know. i will post better pictures. i know the time vale of money stuff already EDIT: HERE IS...

  • Gleim 6 Deductions from AGI [1] Which one of the following expenses does not qualify as...

    Gleim 6 Deductions from AGI [1] Which one of the following expenses does not qualify as a deductible medical expense? A. Cost of long-term care for a developmentally disabled person in a relative’s home. B. Special school for a deaf child to learn lip reading. C. Cost of elevator installed for individual who had heart bypass surgery (in excess of increase in value of individual’s home). D. Cost and care of guide dogs used by a blind person in his...

  • Question 70 2.5 pts In the unemployment rate, part-time workers are: not included in the labor...

    Question 70 2.5 pts In the unemployment rate, part-time workers are: not included in the labor force. included in the labor force, but counted as unemployed. treated the same way as discouraged workers. included in the labor force and counted as employed. Question 69 2.5 pts Which of the following would be officially classified as unemployed? O a school administrator who has been working as a substitute teacher one day per week while looking for a full-time job in administration...

  • Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first...

    Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first summer job. Even though his parents are claiming him as a dependent he wants to file a return in order to get his refund. He receives his W-2 and decides he can do his own return using form 1040-EZ. Which of the following information is not found on a Form W-2? a) The taxpayer’s Social Security number b) The taxpayer’s wages, tips and other...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT