1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Two (Unreachable Statement Errors) Please

Discussion in 'Software Development' started by conkle25Utah, Mar 22, 2013.

Thread Status:
Not open for further replies.
  1. conkle25Utah

    conkle25Utah Thread Starter

    Joined:
    Mar 22, 2013
    Messages:
    7
    Please can I get some help on in this been on it for a few days, and I cannot just seem to find how to fix it. Thanks all.


    class Calculator2 {

    double salary = 51000;
    double base = 120000;
    double commission = .13;

    public double calculateTotalComission(double annualSales) {
    return 123;

    public double calculateTotalCompensation(double annualSales) { .....<<<< Illegal start of expression, unreach statement, and no return statement.
    double totalPay = salary + (annualSales * commission);
    return totalPay;


    if(annualSales> 120000) { ...... <<<<Unreachable Statement
    commission = 0.13 * 1.25;
    System.out.println("Great job on exceeding your sales goal and acquiring the sales incentive!");
    } else if (annualSales >= 96000) {
    commission = 0.13;
    System.out.println("You did not meet your sales goal but will acquire the sales incentive!");
    } else if (annualSales < 96000) {
    System.out.println("You did not acquire your sales incentive or meet your sales goal!");
    }
    }
    }
     
  2. conkle25Utah

    conkle25Utah Thread Starter

    Joined:
    Mar 22, 2013
    Messages:
    7
    Oh and this is Java. Sorry
     
  3. andythepandy

    andythepandy

    Joined:
    Jul 2, 2006
    Messages:
    367
    Please insert your code using the code tages:
    Code:
     code 
    It makes it much easier for people to help you.

    The unreachable statement is caused by:
    Code:
    //EDITED:Sorry, I copied & pasted the wrong bit :s
    double totalPay = salary + (annualSales * commission);
    return totalPay;
    
    Nothing after the return totalPay will run. The unexcepted start is caused by you not closing the calculateTotalComission method with a }
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1093872

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice