CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    1

    if/else structure, how is the structure of it?

    If/else structure i need help?
    using an if/else construct, white a program that will calculate a person's pay based on the number of hours work.

    1.
    = The pay rate is php 35.00 per hour. Any hours worked after 40 hours is paid at the rate of 1.5 times the normal hourly rate. Calculate and display the normal pay, the overtime pay and the total pay.
    =you may test your program using the following test data for the number of hours worked:
    35
    40
    50


    2. modify WorkPay.java by replacing the if/else construct with the swtich statement. Follow the same specifications as indicated above expect for the file name. Name this program as WorkPay2.java

    you may test your program using the following test data for the number of hours worked:
    30
    35
    40
    45
    50

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: if/else structure, how is the structure of it?

    We won't do your homework for you but we will try and help you to do it if you explain exactly what are you stuck on.

    BTW There are plenty of tutorials which explain how to use if-else - have you read any of those?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Nov 2011
    Location
    Vietnam
    Posts
    8

    Re: if/else structure, how is the structure of it?

    Hi student2012,

    the if-else construct is fairly easy to learn. You should learn the basic of it, then apply to your exercise. There is an example here:

    http://www.codejava.net/java-core/th...age/if-keyword

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured