• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating Classes With Java  RSS feed

 
Johnnoo Williams
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what have you tried so far and where are you stuck?
 
Johnnoo Williams
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:So what have you tried so far and where are you stuck?


Haven't done classes before so i'm stuck on that. How to create a class and do the stuff i posted above.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java tutorials would be a good place to start. This is the section on Classes and Objects, which covers the things you're asking about.
 
Johnnoo Williams
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:The Java tutorials would be a good place to start. This is the section on Classes and Objects, which covers the things you're asking about.


Awesome thankyou i'll take a look
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Johnnoo Williams wrote:
Haven't done classes before so i'm stuck on that. How to create a class and do the stuff i posted above.

Strange. You did post some code earlier which had class and constructor and stuff. So that was not your code?
 
Johnnoo Williams
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
Johnnoo Williams wrote:
Haven't done classes before so i'm stuck on that. How to create a class and do the stuff i posted above.

Strange. You did post some code earlier which had class and constructor and stuff. So that was not your code?


Yeah that code was already supplied to me i haven't done it by myself before.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!