1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Creating Classes With Java

Discussion in 'Programming' started by demonlord07, Sep 10, 2013.

  1. #1
    Hey guys i'm working on my own little java program and i was wondering about classes and how i would go about creating one. For the program i'm creating i will need,

    Define a Employee class which includes the instance variables employeeNumber (a String), employeeTitle (a String), employeeName (a String), employeeRole (a String) and payScaleLevel (a char).

    Implement a constructor for the Employee class which accepts the employee Number, employee title, employee name, employee role and pay scale level for the new Employee as parameters and stores the supplied information in the corresponding instance variables.

    How would i go about doing this? Cheers.
     
    demonlord07, Sep 10, 2013 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    ThePHPMaster, Sep 10, 2013 IP
  3. baknet.computers

    baknet.computers Greenhorn

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #3
    [I][I][I][I][I][I][I][I][I][I][I][I][CODE]class Employee
    {
    String employeeNumber, employeeTitle, employeeName, employeeRole;
    char payScaleLevel;
    Employee( String employeeNumber, String employeeTitle, String employeeName, String employeeRole, char payScaleLevel)
    {
    this.employeeNumber = employeeNumber;
    this.employeeTitle = employeeTitle;
    this.employeeName = employeeName;
    this.employeeRole = employeeRole;
    this.payScaleLevel = payScaleLevel;
    } // End of constructor body
    }//End of class[/CODE]

    Call this constructor where required.
    [/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I]

    For any further assistance or coaching in programming in C/C++/C#, Java or Mobile Apps contact me via my gmail/gtalk mentioned in my profile.
     
    Last edited: Sep 14, 2013
    baknet.computers, Sep 14, 2013 IP