Question: I need this code debugged. Every time I debug this code I get Note: DebugFourteen2.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for

I need this code debugged. Every time I debug this code I get

Note: DebugFourteen2.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

// Displays list of payment options // - credit card, check or cash // Displays fee for using each - 5%, 2% or 0%

import javax.swing.*; import java.awt.*; import java.awt.event.*;

public class DebugFourteen2 extends JFrame implements ItemListener { FlowLayout flow = new FlowLayout(); JComboBox payMethod = new JComboBox(); JLabel payList = new JLabel("Pay List"); JTextField totFees = new JTextField(25); String pctMsg = new String("per cent will be added to your bill"); int[] fees = {5, 2, 0}; int feePct = 0; String output; int fee = 0; public DebugFourteen2() { super("Pay List) setDefaultClosetOperation(JFrame.EXIT_ON_CLOSE); setLayout(flowlayout); payMethod.addItemListener(this); add(payList); add(payMethod); payMethod.addItems("Credit card"); payMethod.addItems("Check"); payMethod.addItems("Cash"); add(totFees); } public static void main(String[] arguments) { JFrame cframe = new DebugFourteen2(); cframe.setSize(350,150); cframe.setVisible(true); } @Override public void itemStateChanged(ItemEvent list) { Object source = list.getSource(); if(source == payMethod) { int fee = payMethod.getSelectedIndex(); feePct = fees[fee]; output = feePct + " " + pctMsg; totFees.setTheText(output) } } }

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 Databases Questions!