Question: This project has three parts. Remember to make a copy of this project so you can refer to it when completing the other phases. IMPORTANT:
This project has three parts. Remember to make a copy of this project so you can refer to it when completing the other phases.
IMPORTANT: Please completely read through the instructions before beginning the assignment. If you have any questions, reach out before attempting to complete the assignment.
You are tasked with writing an application that will keep track of insurance policies.
Program Instructions:
Navigate to the Java program you created in the GitHub Repository Instructions document (Project_firstname_lastname - replaced with your name). Note: The project should remain in the CSC151Project folder created in the GitHub Repository Instructions document. If you did not complete the GitHub Repository Instructions, you should complete the steps before starting this assignment.
-
- Open jGRASP and create a new Java file.
- Click File/Save As and save the file in the CSC151Project folder created in the GitHub Repository Instruction document.
- Name the file Policy.java.
- Open (or return to) the GitHub Desktop. The program file added to the repository's directory should appear in the Changes column.
- Click the button Commit to Project-1.
Create a Policy class that will model an insurance policy for one person.
Use the following guidelines to create the Policy class:
- An insurance policy has the following attributes:
- Policy Number
- Provider Name
- Policyholders First Name
- Policyholders Last Name
- Policyholders Age
- Policyholders Smoking Status (will be smoker or non-smoker)
- Policyholders Height (in inches)
- Policyholders Weight (in pounds)
- Include a no-arg constructor (set default values for all fields).
- Include 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*
- BMI = (Policyholders Weight * 703 ) / (Policyholders Height2 ).
- Include a method that calculates and returns the price of the insurance policy*
- The Insurance Policy has a base fee of $600
- If the Policyholder is over 50 years old, there is an additional fee of $75
- If the Policyholder is a smoker, there is an additional fee of $100
- If the Policyholder has a BMI of over 35, there is an additional fee calculated as follows:
- Additional Fee = ( BMI 35 ) * 20
*Note: this is a calculated amount based on some of the attributes above.
Make sure to avoid having a stale value for this calculation. See "Avoiding Stale Data" in Section 6.2
GitHub Desktop Commit:
- Save the project. Minimize the jGrasp window.
- Open the GitHub Desktop program on your computer. You will see your code.
- In the Description window enter the text: Added code for Policy class.
- Click the button: Commit to Project-1.
- Return to your project and continue to complete the next steps.
Demonstrate your Policy class by writing a Demo class. 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 display all 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).
GitHub Desktop Commit:
You will make one last commit to your Project-1 branch. After completing the last commit, you will merge and push all changes to the remote repository.
- In the Description field in the bottom left of the window, enter the text: Added code for demo class.
- Click the Commit to Project-1 button.
- Switch to the main branch by clicking on the Current Branch menu. Select main.
- Go to Branch -> Merge into current branch...
- Select the Project-1 branch.
- Click the button: Merge Project-1 into main.
- This step will merge all the changes into the main branch.
- Click the button: Push origin to push all the changes to the remote repository (i.e., the repository hosted on GitHub.com).
Submission Instructions
- Sign in to GitHub.com.
- Click the CSC151Project repository link. (Note: look under the Repositories list.)
- Click the Policy.java source code file.
- Capture a screenshot of the Project window.
- Submit the screenshot in Blackboard.
Sample Input:
Please enter the Policy Number: 1234
Please enter the Provider Name: State Farm
Please enter the Policyholders First Name: John
Please enter the Policyholders Last Name: Doe
Please enter the Policyholders Age: 24
Please enter the Policyholders Smoking Status (smoker/non-smoker): non-smoker
Please enter the Policyholders Height (in inches): 62.0
Please enter the Policyholders Weight (in pounds): 250.5
Sample Output:
Policy Number: 1234
Provider Name: State Farm
Policyholders First Name: John
Policyholders Last Name: Doe
Policyholders Age: 24
Policyholders Smoking Status: non-smoker
Policyholders Height: 62.0 inches
Policyholders Weight: 250.5 pounds
Policyholders BMI: 45.81
Policy Price: $816.24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
