Results 1 to 2 of 2

Thread: Paycheck help

  1. #1
    spsrar is offline Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Default Paycheck help

    Hey guys......im really stuck on a project its actually wrecking my head i have to...

    Write a class PayCheck that uses dialog boxes to compute the total gross pay of an hourly wage worker. The program should use input dialog boxes to get the number of hours worked and the hourly pay rate from the user. The program should use a message dialog to display the total gross pay. The pay calculation should assume the worker earns time and a half for overtime (for hours over 40).

    so far i have

    //################################################
    // Paycheck.java
    //
    //
    //###############################################

    import java.util.Scanner;

    import javax.swing.*;
    import java.awt.event.*;

    public class Paycheck{
    JFrame frame;
    public static void main(String[] args){
    Paycheck db = new Paycheck();
    }

    public Paycheck(){
    frame = new JFrame("PayCheck");
    frame.setSize(400, 400);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    }

    {

    {
    Scanner in = new Scanner(System.in);
    System.out.println("Wage: ");
    // this where you type in the hourly wage

    double wage = in.nextDouble();
    System.out.println("Hours: ");
    //this is where the number of hours is enterd
    double hours = in.nextDouble();
    }

    {
    double pay;
    if (hours > 40)
    {
    pay = (wage*40) + ((hours-(hours%40)*40)*(overtime*wage));
    }
    else
    {
    pay = wage * hours;
    }
    return int pay;
    }




    }
    }





    any help would be much appresiated? :)

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,782
    Rep Power
    7

    Default Re: Paycheck help

    Help with what?

    My reply is write better code. If you want a more specific answer then ask a more specific question. Actually you never asked any question!

Posting Permissions

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