import java.applet.*; import java.awt.*; import java.awt.event.*; public class CalcPay extends Applet implements ActionListener { Button calcButton = new Button("Enter"); Label enterHours = new Label("Enter your hours worked"); TextField Hours = new TextField(5); Label enterRate = new Label("Enter your hourly rate"); TextField Rate = new TextField(5); Label TotalResult = new Label(" "); public void init() { add(enterHours); add(Hours); add(enterRate); add(Rate); add(calcButton); add(TotalResult); calcButton.addActionListener(this); Hours.addActionListener(this); Rate.addActionListener(this); } public void start() { invalidate(); validate(); } public void actionPerformed(ActionEvent e) { enterHours.setLocation(10,10); Hours.setLocation(350,10); enterRate.setLocation(10,40); Rate.setLocation(350,40); calcButton.setLocation(360,60); TotalResult.setLocation(360,80); double Tax; double TaxedPay; Double numHours = new Double(Hours.getText()); Double numRate = new Double(Rate.getText()); double Gross = (numHours.doubleValue() * numRate.doubleValue()); if(Gross <= 99.99) { Tax = 0.10; TaxedPay = Tax * Gross; Gross = Gross - TaxedPay; TotalResult.setText("" + Gross); } if(Gross >= 100.00 && Gross <= 299.99) { Tax = 0.15; TaxedPay = Tax * Gross; Gross = Gross - TaxedPay; TotalResult.setText("" + Gross); } if(Gross >= 300.00 && Gross <= 599.99) { Tax = 0.21; TaxedPay = Tax * Gross; Gross = Gross - TaxedPay; TotalResult.setText("" + Gross); } if(Gross >= 600.00) { Tax = 0.28; TaxedPay = Tax * Gross; Gross = Gross - TaxedPay; TotalResult.setText("" + Gross); } } } ================================================================== import java.applet.*; import java.awt.*; import java.awt.event.*; public class Quiz6a extends Applet implements ActionListener { Label greeting = new Label("Enter a number for a font example"); Font bigFont = new Font("TimesRoman", Font.ITALIC,16); Button pressMe = new Button("Enter..."); TextField enter = new TextField(10); public void init() { add(enter); greeting.setFont(bigFont); add(greeting); add(pressMe); pressMe.addActionListener(this); } public void actionPerformed(ActionEvent thisEvent) { Font TimesRoman = new Font("TimesRoman", Font.PLAIN, 12); Font Arial = new Font("Arial", Font.PLAIN, 12); Font Italic = new Font("TimesRoman", Font.ITALIC, 12); String Number = enter.getText(); if(enter.getText().equalsIgnoreCase("1")) { Label newtext = new Label("This is an an Example of Times Roman"); newtext.setFont(TimesRoman); add(newtext); } if(enter.getText().equalsIgnoreCase("2")) { Label newtext = new Label("This is an an Example of Arial"); newtext.setFont(Arial); add(newtext); } if(enter.getText().equalsIgnoreCase("3")) { Label newtext = new Label("This is an an Example of Times Roman Italicized"); newtext.setFont(Italic); add(newtext); } else remove(enter); remove(pressMe); remove(greeting); invalidate(); validate(); } }