Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By SurfMan

Thread: i need a help as fast as possible

  1. #1
    whatever is offline Member
    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0

    Default i need a help as fast as possible

    Hi Guys,
    Can you please help me. I have to write a project to calculate 10 employees sales then give them all a bonus of 15% then get the highest one and give him a bonus of 5%.
    But I'm having difficulties . PLEASE SOMEONE HELP

    My Code that I wrote so far (I know it's wrong):

    package project005;
    import java.util.Scanner;

    /**
    *
    * @author whatever
    */

    public class Project005 {
    private static int i;

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    //we wrote the employees names in a string array//

    System.out.println("The Employees No., Sales, Bonus, and Extra Bonus for the Highest Employee");

    String[] employees = new String[10];
    employees[0] = "1";
    employees[1] = "2";
    employees[2] = "3";
    employees[3] = "4";
    employees[4] = "5";
    employees[5] = "6";
    employees[6] = "7";
    employees[7] = "8";
    employees[8] = "9";
    employees[9] = "10";

    int[] sales = {500, 1000, 1200, 700, 800, 1300, 860, 900, 1250, 1010};

    double Bonus;
    Bonus = 0.15;
    System.out.println(Bonus * sales[i]);

    double ExtraBonus;
    ExtraBonus = 0.05;

    int[] ExtraBonus = new int[10];
    int highest = ExtraBonus[10];
    for (int i = 0; i < sales.length; i++){
    if (ExtraBonus[i] > highest)
    highest = ExtraBonus[i];


    System.out.println();

    System.out.println(employees[i] + "," + sales[i] + Bonus + "," + highest + "," + ExtraBonus);
    }
    }}

  2. #2
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    946
    Rep Power
    2

    Default Re: i need a help as fast as possible

    I would like to help, but I don't see your question anywhere...
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  3. #3
    whatever is offline Member
    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0

    Default Re: i need a help as fast as possible

    this is the question

    Develop a Java program that calculate weekly sales bonuses for salespersons at a company, store those values, and finds the employee with the highest sales and applies an extra bonus:
    1. Reads in 10 sales amounts from the user representing the weekly sales of different employees and store the values in an array. Employees will be identified by their numbered position that are entered into the array (i.e. 1st employee, 2nd employee, … ,10th employee).
    The 10 sales amounts to be used for input are: 500, 1000, 1200, 700, 800, 1300, 860, 900, 1250, 1010
    2. For each value stored in the array above, create an element in a second array that stores the bonus calculation based on the formula:

    Bonus = 15% of their respective sales.

    3. Identify the highest employee sales amount and apply an extra bonus of 5% of the total sales for that employee.
    4. Output (Display) all the values in both arrays in the form: employee number (their position in the array as noted above, sales amount, bonus, and total weekly salary (don't worry about formatting, but apply commas between items).
    For example:
    Employee #, weekly sales, weekly bonus, weekly salary
    1, 120.0, 12.0, 132.0
    2, 140.0, 14.0, 154.0
    3, 150.0, 15.0, 165.0

    5. Lastly output the employee number with the highest sales and apply the extra bonus as indicated above and print their total salary based on their sales, initial bonus and extra bonus.
    Last edited by whatever; 01-22-2014 at 09:29 AM.

  4. #4
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    946
    Rep Power
    2

    Default Re: i need a help as fast as possible

    No. That is the *assignment*. A question would be: "When I run this code, I get a NullPointerException on line 45, but I don't know why. Here's the stacktrace and the error message. Does anybody know why this happens?"

    Oh, and PS: wrap your code in a [code][/code] block so we get the goodies as syntax highlighting etc. And make sure it's properly indented, because I got more things to do than trying to unravel spagetti code.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  5. #5
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,008
    Rep Power
    6

    Default Re: i need a help as fast as possible

    If I do that assignment, where do I send the code to get the credit for it?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    Daryn is offline Senior Member
    Join Date
    Oct 2012
    Posts
    176
    Rep Power
    2

    Default Re: i need a help as fast as possible

    Quote Originally Posted by gimbal2 View Post
    If I do that assignment, where do I send the code to get the credit for it?
    What are you talking about sending the code. and what is wrong with your code now. What is it doing. Is it compiling. Is it adding the wrong bonus, will it not find the highest one. What is it? If you want fast help you have to try to as specific as possible
    With the right know how, anything is possible

  7. #7
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    946
    Rep Power
    2

    Default Re: i need a help as fast as possible

    Quote Originally Posted by Daryn View Post
    What are you talking about sending the code. and what is wrong with your code now. What is it doing. Is it compiling. Is it adding the wrong bonus, will it not find the highest one. What is it? If you want fast help you have to try to as specific as possible
    Gimbal2 is not the OP, Mr. "Whatever" is. Gimbal2 is just taking a stab at the posting of the assignment.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  8. #8
    Daryn is offline Senior Member
    Join Date
    Oct 2012
    Posts
    176
    Rep Power
    2

    Default Re: i need a help as fast as possible

    Quote Originally Posted by SurfMan View Post
    Gimbal2 is not the OP, Mr. "Whatever" is. Gimbal2 is just taking a stab at the posting of the assignment.
    Lol oh well thats embarissing. Sorry I was in a hurry leaving for school and the title made it sound important so I got on to help and clearly didn't pay attantion. But okay @whatever what is your code doing wrong. Is it not adding the highest bonus. Is it not compileing. What wrong?
    With the right know how, anything is possible

  9. #9
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,008
    Rep Power
    6

    Default Re: i need a help as fast as possible

    Ha ha ha :) Now imagine this situation: someone asks a question. You reply. Then you get a reply that would make you think that it is the original poster... but it is not.

    That happens to me at least half a dozen times a year where someone else just seamlessly "takes over" and you can only spot it by looking at the user name.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Daryn is offline Senior Member
    Join Date
    Oct 2012
    Posts
    176
    Rep Power
    2

    Default Re: i need a help as fast as possible

    You know being he wants help fast you think he would be active in here
    With the right know how, anything is possible

  11. #11
    QueenAlia is offline Member
    Join Date
    Jan 2014
    Posts
    6
    Rep Power
    0

    Default Re: i need a help as fast as possible

    About your assignment i have a clue where you got it from as i am working on it myself. For your coding i believe it is all good but the parts where you wrote :

    "System.out.println(Bonus * sales[i]);" and " int[] ExtraBonus = new int[10];" are wrong and won't work if you type it down in netbeans ( that is if it is the program you are using).

    I suggest that the first step you take before you start coding is write down on paper a simple algorithm on how you think the solution would be.

    Second thing you need to do is to figure out it's type is it a loop, an array, boolean or what?.

    After that look through your course notes or so on i'm pretty much sure whomever your professor is... he/she probably have given you something similar.

    * Just try to copy what ever you think fits and try it out until it works.

    and just to add the questions themselves give away the answers.

    If i am done with mine i'll try to post the answers here if not oh well...
    Last edited by QueenAlia; 01-26-2014 at 05:51 PM.

  12. #12
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    946
    Rep Power
    2

    Default Re: i need a help as fast as possible

    Quote Originally Posted by QueenAlia View Post
    If i am done with mine i'll try to post the answers here if not oh well...
    May be you shouldn't. Here are the reasons why you shouldn't post the solution here:
    1) He needed this as fast as possible. He's probably too late by now and flunked the test.
    2) He couldn't be arsed to repsond to any reaction.
    3) He *will* copy your stuff and hand it in as his own. He will never have studied and learned a thing. You just spoonfed his cheating ways.

    In the end his diploma, if any, will imply certain knowledge levels. If you spoonfeed the solutions, his diploma means jack squat and only hurts his future collegues who get to clean up his shit.
    PhHein likes this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  13. #13
    QueenAlia is offline Member
    Join Date
    Jan 2014
    Posts
    6
    Rep Power
    0

    Default Re: i need a help as fast as possible

    Quote Originally Posted by SurfMan View Post
    May be you shouldn't. Here are the reasons why you shouldn't post the solution here:
    1) He needed this as fast as possible. He's probably too late by now and flunked the test.
    2) He couldn't be arsed to repsond to any reaction.
    3) He *will* copy your stuff and hand it in as his own. He will never have studied and learned a thing. You just spoonfed his cheating ways.

    In the end his diploma, if any, will imply certain knowledge levels. If you spoonfeed the solutions, his diploma means jack squat and only hurts his future collegues who get to clean up his shit.
    okay if you say so :D
    thanx for telling me :3

Similar Threads

  1. Fast Tunnel
    By Salt7900 in forum Java 2D
    Replies: 0
    Last Post: 05-23-2011, 04:30 AM
  2. Fast Help Plz ..
    By Hamodi18 in forum New To Java
    Replies: 6
    Last Post: 07-16-2010, 05:24 AM
  3. how fast?
    By abdullahansari in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 03:17 AM
  4. Help me fast!
    By Manikyr in forum New To Java
    Replies: 4
    Last Post: 03-16-2009, 07:43 AM
  5. pls help me fast!
    By rexson98 in forum New To Java
    Replies: 10
    Last Post: 10-15-2008, 12:20 PM

Posting Permissions

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