import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Lab7 extends Applet implements ActionListener{
TextField
a = new TextField(10),
b = new TextField(10),
c = new TextField(10),
d = new TextField(10),
inputTF = new TextField(10);
Button compute = new Button(" Compute ");
double input = 0.00;
public void init(){
add(new Label("Enter number: "));
add(inputTF);
add(compute);
add(new Label("roundToInteger( number)"));
add(a);
add(new Label("roundToTenths( number)"));
add(b);
add(new Label("roundToHundredths( number)"));
add(c);
add(new Label("roundToThousandths( number)"));
add(d);
inputTF.addActionListener(this);
compute.addActionListener(this);
a.setEditable(false);
b.setEditable(false);
c.setEditable(false);
d.setEditable(false);
inputTF.requestFocus();
} // End public void init()
public void actionPerformed(ActionEvent e){
input = new Double( inputTF.getText() ).doubleValue();
a.setText(Integer.toString((int)Math.floor(input) ));
b.setText(Double.toString(Math.floor(input * 10 + .5 ) /10 ));
c.setText(Double.toString(Math.floor(input * 100 + .5 ) /100 ));
d.setText(Double.toString(Math.floor(input * 1000 + .5 ) /1000 ));
} // Ends actionPerformed
} // Ends CLASS