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 3 of 3

Thread: I need help with my java program for college

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need help with my java program for college

    I do not know how to make the loop end. I think there is an issue with my second and thrid algorithms... Someone please help..
    Also its a commission calculator

    --- Update ---

    //Start Program
    package commission;
    import java.util.Scanner;
    public class Commission
    {

    private static boolean saleTargetrange;

    public static void main(String[] args) {

    {
    Scanner keyboard = new Scanner(System.in);

    double salary = 50000.00; // Yearly Salary
    double commissionRate = 0.05; // Commision @ 5%
    double bigcommissionRate = 0.065; // Commission at 6.5%
    double sales = 0;
    double goalSales = 96000; //
    double commision = commissionRate * sales;
    double totalPay = salary + commision ; // Total salary with commision
    double salesTarget = 120000; // Gaol to get commission increase.
    saleTargetrange = 96000 <= 120000;
    double maxSales;
    double saleTargetrate = sales * bigcommissionRate; // set sales comminssion
    boolean exit = true;
    int currentNumber = 0; // the number that will be converted to
    String name; // person that made the money


    {

    --- Update ---

    /**
    * Enter name and display a greeting message...
    */
    System.out.println("Hello Welcome To The Commission Calculator:");// greating message
    System.out.print( "Please enter Name:" ); // name of User
    name = keyboard.nextLine();



    /**
    * Yearly Salary
    */
    System.out.print( "Your Base Salary is: $");
    System.out.println(salary);

    /**
    * Entering sales
    */
    System.out.print( "Please enter your sales: $" );
    sales = keyboard.nextInt() ;
    System.out.print("Your sales Commissions are: $");
    /**
    * Loop starts here
    */
    }

    if(sales < goalSales) // Sales less than 80% of target
    {
    System.out.print("Your sals Commission is: $");
    System.out.println(0.00);
    System.out.println(" You Did Not Meet The Criteria To Earn A Commission.");
    System.out.println("Better Luck Next Time.");
    System.out.print("Your total Salary IS: ");
    System.out.println(salary);

    }
    // If true I need to end program here if not carry on to the next loop
    else
    {
    if(sales >= salesTarget) // Sales greater than the 80% but less than 120k

    System.out.print("Your Sales Commission is 0.05: $");
    System.out.println(sales * commissionRate);
    System.out.print("Your Total Earnings are: $");
    System.out.println(sales * commissionRate + salary);

    }
    // If true I need to end program here if not carry on to the next loop

    {
    if(sales >= 121000) // Sales greater than 120k

    System.out.print("Your Sales Commission is 0.06: $");
    System.out.println(sales * bigcommissionRate);
    System.out.print("Your Total Earnings are: $");
    System.out.println(sales * bigcommissionRate + salary);
    }

    }
    }
    }


    // End program


  2. #2
    Member
    Join Date
    Sep 2013
    Posts
    68
    My Mood
    Confused
    Thanks
    3
    Thanked 7 Times in 7 Posts

    Default Re: I need help with my java program for college

    Welcome! If it's your first time here Please Read.

    There is no loop in your program. If you are talking about this

    if(sales < goalSales){
    //your code
    }
    then its not a loop, this is a control statement.

    If you are getting any error in your code then Please post the full error message.

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

    Default Re: I need help with my java program for college

    In addition to posting your code correctly as suggested by aprabhat's link, statements like this:
    I think there is an issue with my second and thrid algorithms
    are minimally helpful. Be specific: Tell us exactly which code you're talking about, and describe the "issues." Posting sample runs can be helpful with descriptions of how the actual output is incorrect or unexpected. Ask specific questions.

Similar Threads

  1. Beginner Java Books & College
    By Hawwi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 12th, 2013, 09:45 AM
  2. Need help with college work!!
    By Dirtyy in forum Object Oriented Programming
    Replies: 4
    Last Post: April 18th, 2013, 11:14 AM
  3. College Assignment
    By EpsilonCM in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 19th, 2012, 05:09 PM
  4. College Assignment please help
    By The Lost Plot in forum Collections and Generics
    Replies: 7
    Last Post: March 13th, 2012, 09:27 AM
  5. College Course-Array
    By samuel17 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 14th, 2010, 10:29 PM