Question: Java 14-8 Finish the JInsurance application that allows the user to choose insurance options in JCheckBoxes. Use a ButtonGroup to allow the user to select

Java 14-8

Finish theJInsuranceapplication that allows the user to choose insurance options in JCheckBoxes. Use a ButtonGroup to allow the user to select only one of two insurance typesHMO (health maintenance organization) or PPO (preferred provider organization). Use regular (single) JCheckBoxes for dental insurance and vision insurance options; the user can select one option, both options, or neither option.

As the user selects each option, display its name and price in a text field; the HMO costs $200per month, the PPO costs $600 per month, the dental coverage adds $75 per month, and the vision care adds $20 per month. When a user deselects an item, make the text field blank.

----------------------------------------------------------Code given-----------------------------------------------------

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class JInsurance extends JFrame implements ItemListener {

FlowLayout flow = new FlowLayout();

ButtonGroup insGrp = new ButtonGroup();

JCheckBox hmo = new JCheckBox("HMO", false);

JCheckBox ppo = new JCheckBox("PPO", false);

JCheckBox dental = new JCheckBox("Dental", false);

JCheckBox vision = new JCheckBox("Vision", false);

JTextField insChoice = new JTextField(20);

String output, insChosen;

public JInsurance() {

// code here

}

public static void main(String[] arguments) {

JInsurance iFrame = new JInsurance();

iFrame.setSize(400, 100);

iFrame.setVisible(true);

}

@Override

public void itemStateChanged(ItemEvent check) {

//code here

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!