Question: Java 1 A little help please. My code is not working. Its a tip calculator and will not run. import java.applet.*; import java.awt.*; public class

Java 1

A little help please. My code is not working.

Its a tip calculator and will not run.

import java.applet.*; import java.awt.*;

public class StuLaTipCal extends Applet implements ActionListener { CheckboxGroup percentGroup = null; Label billAmountLabel = new Label("Enter Amount"); TextField billAmount, totalAmount; Label taxAmountLabel = new Label("Tax in percentage"); Label totalAmountLabel = new Label("Total Amount to be paid"); public void init() { billAmount = new TextField(8); totalAmount = new TextField(8); percentGroup = new CheckboxGroup(); //create checkboxes Checkbox five = new Checkbox ("5%", percentGroup, true); Checkbox eighteen = new Checkbox ("18%", percentGroup, false); Checkbox twentyEight = new Checkbox ("28%", percentGroup, false); Button calButton = new Button ("Calculate"); add(billAmountLabel); add(billAmount); add(taxAmountLabel); add(five); add(eighteen); add(twentyEight); add(calButton); add(totalAmountLabel); add(totalAmount); calButton.addActionListener(this); } public void actionPerformed(ActionEvent ae) { int num1 = Integer.parseInt(billAmount.getText()); int num2 = Integer.parseInt(percentGroup.getLabel()); int percent = (num2/100)*num1; totalAmount.setText(Integer.toString(sum));

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!