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.
This link has an example with all of what you are requesting: http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html Also for your different type of variables: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
[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.