Question

Write a program in java. You are tasked with writing an application that will keep track...

Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s Height (in inches) o Policyholder’s Weight (in pounds) • Include a no-arg constructor and a constructor that accepts arguments (it must accept all necessary arguments to fully initialize the Policy object) • Include appropriate setters and getters (i.e., mutator and accessor methods) for each field • Include a method that calculates and returns the BMI of the policyholder* o BMI = (Policyholder’s Weight * 703 ) / (Policyholder’s Height2 ). • Include a method that calculates and returns the price of the insurance policy* o The Insurance Policy has a base fee of $500 o If the Policyholder is over 50 years old, there is an additional fee of $50 o If the Policyholder is a smoker, there is an additional fee of $100 o If the Policyholder has a BMI of over 40, there is an additional fee calculated as follows:  Additional Fee = ( BMI – 40 ) * 50 *Note: this is a calculated amount based on some of the attributes above. Make sure to avoid having a stale value for this. See "Avoiding Stale Data" in Section 6.2 Demonstrate your Policy class by writing a Demo class called InsurancePoliciesDemo.java . The Demo class should ask the user to enter all necessary information, create a single instance of the Policy class using the constructor that accepts arguments, and then displays all of the information about the policy using the appropriate methods of the Policy class. See the Sample Input and Output below for how to format the input and output of the Demo class (make sure to match the wording and formatting exactly). Sample Input: Please enter the Policy Number: 1234 Please enter the Provider Name: State Farm Please enter the Policyholder’s First Name: John Please enter the Policyholder’s Last Name: Doe Please enter the Policyholder’s Age: 24 Please enter the Policyholder’s Smoking Status (smoker/non-smoker): non-smoker Please enter the Policyholder’s Height (in inches): 62.0 Please enter the Policyholder’s Weight (in pounds): 250.5 Sample Output: Policy Number: 1234 Provider Name: State Farm Policyholder’s First Name: John Policyholder’s Last Name: Doe Policyholder’s Age: 24 Policyholder’s Smoking Status: non-smoker Policyholder’s Height: 62.0 inches Policyholder’s Weight: 250.5 pounds Policyholder’s BMI: 45.81 Policy Price: $790.60 The program should consist of two classes. I got only the Demo program. i got the solution from you for the program and the demo. now we need the demo to me modified as follows Step 1 Add documentation comments (also referred to as "javadoc" comments) to all of the methods of your Policy class. See "Using the @param Tag in Documentation Comments" Step 2 Modify the Demo class to read information about a set of Insurance Policies from a text file (named PolicyInformation.txt) instead of asking the user for input. The text file contains information in the following order: • o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s Height (in inches) o Policyholder’s Weight (in pounds) The program should create Policy objects for each of the policies contained in the file, and should be able to handle a file of any size. The Policy objects should be stored in a structure that can automatically adjust to accommodate the number of objects being stored in it. Use an array Step 3 The demo program should display the same information as the output in Project 1 for each of the Policy objects by iterating over the structure that the Policy objects are being stored in. Step 4 The demo program should display the number of Policyholders that are smokers and the number of Policyholders that are non-smokers. Sample Output Policy Number: 3450 Provider Name: State Farm Policyholder's First Name: Alice Policyholder's Last Name: Jones Policyholder's Age: 20 Policyholder's Smoking Status (smoker/non-smoker): smoker Policyholder's Height: 65.0 inches Policyholder's Weight: 110.0 pounds Policyholder's BMI: 18.30 Policy Price: $600.00 Policy Number: 3455 Provider Name: Aetna Policyholder's First Name: Bob Policyholder's Last Name: Lee Policyholder's Age: 54 Policyholder's Smoking Status (smoker/non-smoker): non-smoker Policyholder's Height: 72.0 inches Policyholder's Weight: 200.0 pounds Policyholder's BMI: 27.12 Policy Price: $550.00 Policy Number: 2450 Provider Name: Met Life Policyholder's First Name: Chester Policyholder's Last Name: Williams Policyholder's Age: 40 Policyholder's Smoking Status (smoker/non-smoker): smoker Policyholder's Height: 71.0 inches Policyholder's Weight: 300.0 pounds Policyholder's BMI: 41.84 Policy Price: $691.85 Policy Number: 3670 Provider Name: Global Policyholder's First Name: Cindy Policyholder's Last Name: Smith Policyholder's Age: 55 Policyholder's Smoking Status (smoker/non-smoker): non-smoker Policyholder's Height: 62.0 inches Policyholder's Weight: 140.0 pounds Policyholder's BMI: 25.60 Policy Price: $550.00 Policy Number: 1490 Provider Name: Reliable Policyholder's First Name: Jenna Policyholder's Last Name: Lewis Policyholder's Age: 30 Policyholder's Smoking Status (smoker/non-smoker): non-smoker Policyholder's Height: 60.0 inches Policyholder's Weight: 105.0 pounds Policyholder's BMI: 20.50 Policy Price: $500.00 Policy Number: 3477 Provider Name: State Farm Policyholder's First Name: Craig Policyholder's Last Name: Duncan Policyholder's Age: 23 Policyholder's Smoking Status (smoker/non-smoker): smoker Policyholder's Height: 66.0 inches Policyholder's Weight: 265.0 pounds Policyholder's BMI: 42.77 Policy Price: $738.37 The number of policies with a smoker is: 3 The number of policies with a non-smoker is: 3

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Write a program in java. You are tasked with writing an application that will keep track...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • I am having problems with my java homework in class. Write a program that will interactively...

    I am having problems with my java homework in class. Write a program that will interactively read the name, age, weight in pounds, and height in inches for five people and output the BMI for each one. At the end of the program, it should output the average age, average height and average weight of the five participants. IT HAS TO INCLUDE: Declare and use a program constant of data type int named CONVERSION_FACTOR to represent the value 703. Use...

  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

  • IT Java code In Lab 8, we are going to re-write Lab 3 and add code...

    IT Java code In Lab 8, we are going to re-write Lab 3 and add code to validate user input. The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy level for a given height. The formula is as follows:                 bmi = kilograms / (meters2)                 where kilograms = person’s weight in kilograms, meters = person’s height in meters BMI is then categorized as follows: Classification BMI Range Underweight Less...

  • javafx 1. Implement a BMI (Body Mass Index) server that will accept height and weight from...

    javafx 1. Implement a BMI (Body Mass Index) server that will accept height and weight from the client, calculate the BMI and return a string with the BMI and a status (l.e. normal, over weight, etc.). Build a GUI using JavaFX. You are given a working BMI class that will do the BMI calculations, etc. A single BMI client connection is sufficient. 2. Implement a JavaFX BMI client that will allow the user to enter height (in inches), weight (in...

  • In Java Body mass index is a measure of whether someone's weight is appropriate for their...

    In Java Body mass index is a measure of whether someone's weight is appropriate for their height. A body- mass-index value between 19 and 25 is considered to be in the normal range. Here's the formula for calculating body mass index: BMI- (704 x weight in pounds) / height in inches*2 a) Implement a program that prompts the user for height and weight values and displays the associated body mass index. Perform input validation by making sure that the user...

  • I have this C program that calculates an input and converts it to a BMI calculation....

    I have this C program that calculates an input and converts it to a BMI calculation. Any idea how this would look as an LC3 program? I'm taking an LC3 programming class next semester and want an idea of what this code would even translate to, just trying to get a head start. I'm more so curious on how to get user input in a LC3 program, then I can try myself and figure it out from there. int main()...

  • Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how...

    Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how many days it will take to lose a specific number of pounds. The program will perform the following tasks: Declare variables and Named constants. Display “Welcome to <your name>’s Weight Loss Calculator” Prompt the user to enter the subject’s current weight. Prompt the user to enter the subject’s height in feet plus inches. Prompt the user to enter the subject’s age. Prompt the user...

  • Please write this code in C++ Object-Oriented Programming, specify which files are .h, and .cpp, and...

    Please write this code in C++ Object-Oriented Programming, specify which files are .h, and .cpp, and please add comments for the whole code. Include a class diagrams, and explain the approach you used for the project and how you implemented that, briefly in a few sentences. Please note the following: -Names chosen for classes, functions, and variables should effectively convey the purpose and meaning of the named entity. - Code duplication should be avoided by factoring out common code into...

  • (JAVA) Using classes and inheritance, design an online address book to keep track of the names

    (JAVA)Using classes and inheritance, design an online address book to keep track of the names, addresses, phone numbers and birthdays of family members, friends and business associates. Your program should be able to handle a maximum of 500 entries.Define the following classes: Class Address to store a street name, city, state and zip code. Class Date to store the day, month and year. Class Person to store a person's last name and first name. Class ExtPerson that extends the class...

  • Write a JAVA program that declares a class Pet  With three variables Name, Age, weight .The class...

    Write a JAVA program that declares a class Pet  With three variables Name, Age, weight .The class has  different constructors the first without parameters ,the  second with three parameters and the third with two parameters. In the main method  create three objects using thee different constructors to initialize the Variables.  then print out all the information a bout all objects .

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
ADVERTISEMENT