Results 1 to 3 of 3

Thread: Help!

  1. #1
    Join Date
    Jan 2008
    Location
    Philadelphia
    Posts
    2
    Rep Power
    0

    Default Help!

    I need to create a swing applet that will allow the entering of hours worked and an hourly rate, using a JButton. The program also must taxes will be subtracted from gross pay. Any ideas?

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    Location
    NewEngland, US
    Posts
    835
    Rep Power
    10

    Default

    Where's your creation? Post your code using code tags. And welcome to the Java Forums. :)

    -Capt
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

  3. #3
    Join Date
    Jan 2008
    Location
    Philadelphia
    Posts
    2
    Rep Power
    0

    Default 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)

    {

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •