Answered You can hire a professional tutor to get the answer.

QUESTION

Download the files named SalesApplet.java and SalesApplet. Complete the program to accept three sales prices, total the prices and add 6% for sales...

Download the files named SalesApplet.java and SalesApplet.html. Complete the program to accept three sales prices, total the prices and add 6% for sales tax. Create three get methods to obtain each item's price and one set method to output as shown below on a button click. Name your methods getItem1(), getItem2(), getItem3() and setOutput(). Include error checking in the actionPerformed() method that checks to make sure each item is between 1.00 and 10.00. If any of the items is in error, set the output label to indicate the proper input. Call a clearFields() method that clears ALL textFields and sets the focus back to the Item 1 field.

Sales = $XXX.XX Tax =: $XX.XX Total = $XXX.XX

Submit SalesApplet.java

//--------------------SalesApplet.java--------------------------------------------------

import javax.swing.JApplet;

import java.applet.Applet;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.text.DecimalFormat;

public class SalesApplet extends Applet implements ActionListener

{

/**

*

*/

private static final long serialVersionUID = 1L;

//Create components for applet

double item1, item2, item3,itemTotal, tax = 0.06, total, taxAmt;

DecimalFormat twoDigits = new DecimalFormat("$#,###.00");

Label titleLabel = new Label(" Sales Tax Calculator ");

Label itemOneLabel = new Label("Item 1: ");

TextField itemOneField = new TextField(20);

Label itemTwoLabel = new Label("Item 2: ");

TextField itemTwoField = new TextField(20);

Label itemThreeLabel = new Label("Item 3: ");

TextField itemThreeField = new TextField(20);

Label outputLabel = new Label(" ");

Button calcButton = new Button("Calculate");

public void init()

{

}

public void actionPerformed1(ActionEvent e)

{

}

public double getItem1()

{

System.out.println(" enter the price of item 1");

return

}

public double getItem2()

{

return

}

public double getItem3()

{

return

}

public void setOutput(add parameters)

{

}

public void clearFields()

{

}

@Override

public void actionPerformed(ActionEvent arg0) {

// Auto-generated method stub

}

}

//----------------SalesApplet.html

<html>

<head>

<title>MT2 EKD</title>

</head>

<body>

<applet code="SalesApplet" width = "300" height = "300" ></applet>

</body>

</html>

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question