JAVA CODE
//Pay_scroll program import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Pay_scroll extends Applet implements AdjustmentListener { Label Slider1Lbl, Slider2Lbl; Scrollbar Slider1, Slider2; int Slider1Value, Slider2Value; public void init() { Slider1Lbl = new Label (" Enter the rate : " ); add(Slider1Lbl); Slider1 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 200); Slider1.addAdjustmentListener (this); add(Slider1); Slider2Lbl = new Label (" Enter the hours : " ); add(Slider2Lbl); Slider2 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 48 ); Slider2.addAdjustmentListener (this); add(Slider2); } public void paint( Graphics g ) { int sum = Slider1Value * Slider2Value; g.drawString("The rate is : " + Slider1Value, 50, 100); g.drawString("The hours is : " + Slider2Value, 50, 120); g.drawString("Your pay is " + sum, 50, 140 ); } public void adjustmentValueChanged( AdjustmentEvent e ) { if (e.getSource() == Slider1) Slider1Value = e.getValue(); else Slider2Value = e.getValue(); repaint(); } }