1 Reply Latest reply on Oct 9, 2014 10:38 AM by PhHein

    Create a Employee Class

    jagbir singh

      Hello, Kindly help me , to create a Employee class as per given requirements. Requirements are given below 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.