HELP! Java Programmers needed!

Discussion in 'Off Topic' started by Please_Respect_Tables, Apr 21, 2015.

  1. Help me please :D started a introduction to Java course.

    A) Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a double annual sales amount. Methods include a constructor that requires values for both data fields, as well as get and set methods for each of the data fields. Write an application named DemoSalesperson that declares an array of 10 Salesperson objects. Set each ID number to 9999 and each sales value to zero. Display the 10 Salesperson objects. Save the files as Salesperson.java and DemoSalesperson.java.

    B) Modify the DemoSalesperson application so each Salesperson has a successive ID number from 111 through 120 and a sales value that ranges from $25,000 to $70,000, increasing by $5,000 for each successive Salesperson. Save the file as DemoSalesperson2.java.

    This is what I have so far for the Salesperson class in the first half of question A.



    public class Salesperson
    {

    private int IDnumber;
    private double Salesamount;
    public Salesperson(int ID, double Sales)
    {
    IDnumber = ID;
    Salesamount = Sales;
    }
    public int getIDnumber()
    {
    return IDnumber;
    }
    public void setIDnumber(int ID)
    {
    IDnumber = ID;
    }
    public double getSalesamount()
    {
    return Salesamount;
    }
    public void setSalesamount(double Sales)
    {
    Salesamount = Sales
    }

    }

    This is my Salesperson class (first half of question A).

    Is this right?

    Also can you give me tips for the 2nd half of question A (DemoSalesperson) and question B (DemoSalesperson2).

    :D
     
  2. Ask Yafi? They might know
     
  3. Hit it with a hammer
     
  4. Stackoverflow go there for help. Also you'll need a main class to call to start the whole process.
     
  5. Also you'll want a sales value. I would make something like this:
    Public static void main(string [] args)
    {
    Salesperson[] list_of_ten = New Salesperson[(number of people you need)];
    for(int x =0; x<(number of people needed goes here); x++)
    {
    list_of_ten[x] =Salesperson(111+x,25000+5000*(x));//I think
    }

    }
    Public class Salesperson()
    {
    Int idNumber;
    Int sales;
    Public Salesperson(int n, int s)
    {
    idNumber=n;
    sales =s:

    }
     
  6. Yup. Ask Yafi.. They know about programming inside out. They might teach u some tricks too ;)
     
  7. If by tricks you mean automated system actions such as clicking a desired location. Use this:

    Import java.awt.robot.*;
    Also need like 4/5 other import statements and the auctual code though.
     
  8. Wish yafi can teach me those mechanics
     
  9. I ain't yafi! And yafi probably doesn't know. If people use bots typically they obtain them through3rd party stuff. notnself create. This leads to patterns in the algorithms/actions and is why there can be "caught".
     
  10. At any rate. Op if you want to follow me I can send you code that does that.
     
  11. You need to initialise each id to 9999 and default sales to 0. Also make sure u capture the errors like the array going outside 10 etc.You will earn more marks.
     
  12. Bull. Just use the Random class. Saves time and effort. Also data.
     
  13. I'm trying to help him. There is no where in his code he has done that. I'm not trying to write his code for him.
     
  14. But he only needs to instantiate 10 sales people. Not 10 thousand.
     
  15. He will lose marks if its not customisable in case they change their mind.
     
  16. Nah don't just set a random number, really how professional is that.. It looks like he initialized his instance variables in this code. I'm not sure if his 2 parameters when he made the method SalesPerson were already filled with values, but if they were he is good
     
  17. Plus in the code are you starting your salesperson method by just saying Public Salesperson??