Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

2. What characteristics of a market can create the lemons problem?

Answered: 1 week ago