The payroll department in your organisation has overthe years depended on manual
ID: 3617206 • Letter: T
Question
The payroll department in your organisation has overthe years depended on manual way of calculating theemployee’s salary. The head of that department requires youto create a simple system to ease up their work. Create the simplesystem by doing the following (i) Rewrite the payroll as anapplet. Provide a text field for the number of hours, a text fieldfor the pay rate, and a non-editable text field for the output.Also provide labels to identify all three text fields and a buttonto calculate the result. The payroll department in your organisation has overthe years depended on manual way of calculating theemployee’s salary. The head of that department requires youto create a simple system to ease up their work. Create the simplesystem by doing the following (i) Rewrite the payroll as anapplet. Provide a text field for the number of hours, a text fieldfor the pay rate, and a non-editable text field for the output.Also provide labels to identify all three text fields and a buttonto calculate the result.Explanation / Answer
please rate - thanks import java.awt.*; import java.applet.*; import java.awt.event.*; public class untitled extends Applet implements ActionListener { double hours, rate,pay; Label hourslabel = new Label("hours worked"); TextField hoursfield = newTextField(10); Label payratelabel = new Label("pay rate"); TextField payratefield = newTextField(10); Label paylabel = new Label("Salary"); TextField payfield = newTextField(10); Button calculate = new Button("Calculate"); public void init() { add(hourslabel); add(hoursfield); add(payratelabel); add(payratefield); add(paylabel); add(payfield); add(calculate); calculate.addActionListener(this); payfield.setEditable(false); } public void actionPerformed(ActionEvente) {String inputString; inputString=hoursfield.getText(); hours=Double.parseDouble(inputString); inputString=payratefield.getText(); rate=Double.parseDouble(inputString); pay=hours*rate; payfield.setText("$"+pay); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.