|
Sorry for the brainfart
Here is what I have so far.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JCalculatePay extends JApplet implements
ActionListener
{
JLabel companyName = new JLabel("Pay roll Swing Applet");
JButton calcButton = new JButton("Calculate");
JLabel perHoursWorked = new Jlabel("Number of hours worked");
JLabel totalhourlyRate = new JLabel("Rate per hours worked");
Font bigFont = new Font ("Times New Romans", Font. BOLD, 20);
public void init()
{
// get containers set up
Container con = getContentPane();
con.setLayout(new FlowLayout());
companyName.setFont(bigFont);
con.add (companyName);
con.add (calcButton);
calcButton.addActionListener(this);
con.add(perHoursWorked);
con.add(totalhourlyRate);
}
}
public void start()
{
perHoursWorked.setText("Number of hours worked");
TotalhourlyRate.setText("Rate per hours worked");
Repaint();
}
class AddListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
Object source=e.getSource();
if (source==calcButton);
{
String response=JOptionPane.showInputDialogbox(null
"Enter the number of income earned");
int[] incomeEarned(0, 100,300,600,);
int[] federalWitholding(10,15,21,28,);
//declare variable
int income = Integer.parseInt(response);
int individualIncome =0,grossPay=0;
int X=0, a=0;
for (X=4,X <=0,--X)
if(income>=incomeLimit[X])
{
individualIncome=ratePerHoursWorked
grossPay=individualIncome-federalWithholding
}
perHoursWorked.setText("$"+individualIncome + "hoursWorked")
totalHourlyRate.setText("ratePerHoursWorked" + income)
{
}
|