JAVA CODE
// Ex12_8 program import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Ex12_8 extends Applet implements ActionListener { Label TaxStr; TextField TaxText; float tax; public void init() { TaxStr = new Label("Enter the amount : "); add(TaxStr); TaxText = new TextField(15); TaxText.addActionListener(this); add(TaxText); } public void paint( Graphics g) { if( tax <= 10000) g.drawString(" This amount requires no Tax ",50,50); else { double TaxPayable = 0; TaxPayable = (tax - 10000)*0.33; g.drawString("Your Tax is $ "+TaxPayable,50,50); } } public void actionPerformed( ActionEvent e) { tax = Float.valueOf(TaxText.getText()).floatValue(); repaint(); } }