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

Thread: Create Employee Class

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

    Default Create Employee Class

    Hello, Kindly help me for creating a class. Specification are given as:

    Create a class called Employee that includes three pieces of information as instance variables:
    - Employee ID (string type)
    - first name (string type) (default value ‘John’)
    - last name (string type) (default value ‘Smith’) and
    - monthly salary (type double).
    - No argument constructor that initializes the three instance variables. The employee id should be generated using the following process:
    The employee id should be a combination of first initial, last initial and a number starting from 10001 for the first employee and increasing by one for each employee. e.g. if John Smith is the first employee then its id will be JS10001 and if George Brown is the second employee then its id will be GB10002
    - Provide get and set methods for each instance variable. The set method for monthly salary should ensure that its value remains positive – if an attempt is made to assign a negative value, leave the original value.


    thanks


  2. #2
    Junior Member
    Join Date
    May 2013
    Location
    Charleston SC
    Posts
    21
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default Re: Create Employee Class

    what have you tried?

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Create Employee Class

    The question is very straightforward. Create a instance class, four instance variables, one constructor, and two instance methods.

  4. #4
    Junior Member
    Join Date
    Oct 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Create Employee Class

    i have problem with employeeid. how to create it?

  5. #5
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: Create Employee Class


  6. #6
    Junior Member
    Join Date
    Dec 2013
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Create Employee Class

    If you are allowed to use substring() method, use it to take out the first letter of one's first name and last name. If you are not allowed, use array.

Similar Threads

  1. [SOLVED] Help with Employee Class
    By Caffeine in forum What's Wrong With My Code?
    Replies: 19
    Last Post: June 3rd, 2014, 05:29 PM
  2. Help with sorting Employee class
    By sunilshiwankar in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 5th, 2014, 03:48 AM
  3. The Employee class
    By vercammen in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 14th, 2013, 02:27 AM
  4. Replies: 3
    Last Post: April 13th, 2011, 03:30 PM