Results 1 to 4 of 4
  1. #1
    Winter is offline Member
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default Really New Here can someone help me??

    HERE IS THE PROBLEM:
    the pay rate is php 35.00 per hour. any hours worked after 40 hours is paid at rate of 2 times the normal hourly rate. Calculate and display the Normal Pay, The overtime pay, and the total pay.

    and can u please give me a code that any number(hours) you will put will be accepted on my

    OUTPUT MUST BE:
    Sample 1
    Enter Hours Worked: 40 (Sample)
    Normal Pay: 1400 (Sample)
    Overtime Pay: 0 (Sample)
    Total Pay: 1400 (Sample)

    Sample 2
    Enter Hours Worked: 41 (Sample)
    Normal Pay: 1400 (Sample)
    Overtime Pay: 70 (Sample)
    Total Pay: 1470 (Sample)


    here is my code or something, but i cant finish it. or dont know what to do next. can someone help me?? or i dont know what will i put. :/

    ================================================== =========================

    import java.util.Scanner;
    public class Workpay {

    public static void main(String[]args) {
    Scanner in = new Scanner (System.in);
    int hours;
    int normalpay = 35;
    int overtimepay = 2;
    System.out.print("Enter Hours Worked: ");
    hours = in.nextInt();

    if (hours == 40)
    System.out.println("Normal Pay: "+hours*np); <<<< ?? HELP ??
    System.out.println("Overtime Pay: "); <<<< ?? HELP ??
    System.out.println("Total Pay: "); <<< ?? HELP ??
    else
    DIDNT FISH THIS PART <<< ?? HELP ??

    }


    }

    ================================================== =========================

    THANKS FOR REPLYING IN ADVANCE. Stil a newbie to this. :D
    Last edited by Winter; 09-12-2014 at 12:35 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Really New Here can someone help me??

    Do you have any specific questions about the code?

    One problem I see is the code doesn't use {} to surround blocks of code inside of the if statement.

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Ronin is offline Senior Member
    Join Date
    Oct 2010
    Posts
    393
    Rep Power
    9

    Default Re: Really New Here can someone help me??

    Hi Winter, welcome.

    Forget about that if statement for now. Regardless of the hours worked you still want to print out all of the pay information.
    The only condition under which you will see normal pay is if the hours equal 40. The other lines are dispayed regardless. You will need to work out the hours worked over the 40 to calculate the overtime pay so this would likely need an if statement here.

    Regards.

  4. #4
    Leo1991 is offline Member
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default Re: Really New Here can someone help me??

    Hey Winter, I'm brand new to Java myself, I started last Friday. I thought I would go ahead and get my feet wet though as the both of the books I am reading suggest joining forums. Besides the general formatting errors, which your IDE should help you with, I needed a few more variables to get a working program, or class, I am not really sure what the correct term would be. Anyways, that's where I would start. Best of luck!

Tags for this Thread

Posting Permissions

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