HC Healthcare policies are priced as follows: • The annual cost of basic healthcare for one person is €426. This includes insurance as an outpatient, for one person, aged between 18 and 50...

1 answer below »
HC Healthcare policies are priced as follows: • The annual cost of basic healthcare for one person is €426. This includes insurance as an outpatient, for one person, aged between 18 and 50 (inclusive). People under 18 cannot buy a policy directly but can be a dependant on a policy. A person who is over 50 will be subject to an additional charge of €80. • Insurance for dependants on the same policy costs as follows: - 1 st dependant: €250 - 2 nd dependant: €150 - 3 rd dependant: €100 - 4 th dependant: €50 Additional dependants are free, up to a maximum of 6 dependants in total. Each dependant’s name and age must be on the policy and each dependant must be under 18 years of age. • Inpatient insurance costs an additional €200. This includes insurance for a semi-private room. Insurance for a private room costs €100 extra. Inpatient insurance does not extend to any dependants listed on the policy. • A customer can avail of 0, 1 or 2 of the following extras: - Orthopaedic care - Ophthalmic care - Maternity care - Fertility care - Psychiatric care Each additional extra costs €50. Additional extras do not extend to any dependants listed on the policy. VAT of 21% is charged on the healthcare policy. You are required to design, code and test a program that will read in the details of a prospective insurer, calculate the cost of their health insurance, and output a quotation in the format shown below. The program is to run until there are no further quotations to be made. HCI Healthcare Policy Name: Number of dependents: List the name, age and cost of each dependent (if any) here. Basic cost (outpatient care): Inpatient cost: Room type: Additional extras: Total before VAT: Total: Page 3 of 4 Notes: • User input is to be checked to ensure that it is correct (e.g. ensure that the number of dependents is between 0 and 6 inclusive, make sure that choices e.g. inpatient care or not, are valid etc.) • The border for the policy quotation is for illustration only and need not be drawn. • Basic cost is €426 or €426 + €80 as outlined in the first paragraph of the narrative. • For inpatient cost, output “Yes” if the person is buying inpatient insurance, output “No” if the person is not buying inpatient insurance. • For room type, output “NA” if the person is not buying inpatient insurance (with a cost of €0), otherwise output “Private” or “Semi-Private” as appropriate and with the relevant cost. • For additional extras, output “None” if the person is not paying for additional insurance extras, otherwise output a list of the additional extras that the person buying insurance for. • All monetary values are to be suitably formatted. Submit 1. Documentation • An algorithm for your program. • Comments within your program. • A data dictionary 2. The testing of your program You must include at least 4 items of test data. This data should include a suitable mix of data that robustly tests your program code. • For each test, indicate what you are testing e.g. testing that calculations are correct, testing that the program loops until a valid number of dependants is read in etc. • Include the expected results of your test data. • Include screenshots of your test data and results. 3. Your work uploaded to Moodle You will upload two files to Moodle. i. Skills Demo # 2 – PDF. A single PDF document containing: a. Algorithm b. Data dictionary c. Source code (keep the formatting that is in Eclipse when you paste the code). d. Test data with your expected results. e. Test data with the actual results. ii. Skills Demo 2 – Java source code Upload your .java code located in the src folder.
Answered Same DayFeb 25, 2021

Answer To: HC Healthcare policies are priced as follows: • The annual cost of basic healthcare for one person...

Arun Shankar answered on Feb 26 2021
155 Votes
import java.util.Scanner;
public class Driver
{
    static Scanner scan = new Scanner(System.in);
    
    /*
    
* A helper function to get an integer input.
     * The number must be between low and high (both inclusive).
     * If the number is out of the range, prompt the user
     * to enter again.
     */
    private static int getInput(int low, int high)
    {
        String input;
        int value = low - 1;
        while((value < low) || (value > high))
        {
            System.out.print("Enter [" + low + " - " + high + "]: ");
            input = scan.nextLine();
            value = Integer.parseInt(input);
        }
        
        return value;
    }
    
    public static void main(String[] args)
    {
        int numOfDependents = 0, totalCostDependents = 0, totalBeforeVAT = 0, basicCost = 426;
        int additionalCharge = 0, policyHolderAge, inpatientCost = 0, roomCost = 0, additionalExtras = 0;
        double totalAfterVAT = 0, vatCharge = 0;
        boolean inpatient = false;
        String nameOfPolicyHolder;
        int input;
        
        String[] dependentsName = new String[6];
        int[] dependentsAge = new int[6];
        int[] costdependents = {250, 150,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here