Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Need a seond set of eyes I can find where the errors are

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need a seond set of eyes I can find where the errors are

    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    /**
    *
    *
    */
    public class CommissionCalculationProgramII {

    }
    public static void main(String[] args)
    {
    // define variables & initialize them
    double salary = 75000.00 ; // Salesperson fixed salary $75000
    double rate = .05 ; // Salesperson commission rate 5%
    double annual; // Inputted annual sales
    double compensation; // Annual compensation
    double target= 120000; // Target sales


    // Output message for user to input annual sales
    System.out.println("Please input annual sales: ") ;
    Scanner input = new Scanner(System.in) ;
    annual = input.nextDouble() ;
    compensation = annual * rate + salary ;

    // Output information for user to receive annual compensation information
    System.out.println("Your annual compensation is: " + compensation) ;

    // Output information for displaying the table of potential total annual
    // compensation.
    System.out.println("Total Sales\t\tTotal Compensation");
    System.out.println("------------------------------------");
    {
    if(annual <=80.0*target/100.0)
    compensation = 0;
    else if(annual <=target)

    if(annual = 25.0*target/100.0);
    else compensation = 25.0*annual/100+
    rate2*annual;
    }
    }

    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Need a seond set of eyes I can find where the errors are

    Welcome! Please post code in formatting tags. You can learn how in the Announcements at the top of this sub-Forum.

    What errors are you trying to correct? Please post the error messages with the stack trace EXACTLY (copied and pasted) as they appear at your end.

  3. #3
    Member
    Join Date
    Sep 2013
    Posts
    70
    Thanks
    1
    Thanked 13 Times in 13 Posts

    Default Re: Need a seond set of eyes I can find where the errors are

    {
    if(annual <=80.0*target/100.0)
    compensation = 0;
    else if(annual <=target)
     
    if(annual = 25.0*target/100.0);
    else compensation = 25.0*annual/100+
    rate2*annual;
    }

    Take a look at that portion and correct the issues and make sure to use [code] *** Code between tags *** [/code] when posting code to the forums make it easier for everyone. Also what other errors are you getting?

  4. #4
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: Need a seond set of eyes I can find where the errors are

    Hello.
    You can't write methods in java outside a class unlike C++. Your main method is outside.
    You have syntax errors in your if-else logic. And you have one extra brace.

    Syed.

Similar Threads

  1. Program errors because it cannot find something it shouldnt be looking for
    By CrazyCrinkle in forum Object Oriented Programming
    Replies: 3
    Last Post: July 3rd, 2013, 01:11 PM
  2. Java Program Help! Cant find errors
    By frenchsasha in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 6th, 2013, 10:30 AM
  3. Cannot Find Variable/Symbol Errors... why?
    By bgroenks96 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 9th, 2011, 04:12 AM
  4. [SOLVED] Could someone help me find my errors on this program?? (homework)
    By r19ecua in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2011, 10:25 PM
  5. Help with Cannot Find Symbol Variable errors
    By skboone in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 20th, 2010, 10:52 AM