Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector

 
Peter Mcmac
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I go about designing a class named RealLife which will create 1 company and 5 employees.All Employees will be hired and 2 will be fired.Company must know how many employees it has at all times and what its payrooll is .
Employee contains salary, ID, age, and position.
Each has a name, gender, and an address.
Company also has name and address.
Can I somehow use vector.
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, this homework problem almost writes itself.
Hopefully you know how to write a class and give it member variables.

I'll get you started:
class Employee
double salary
int (or String or double...) ID
int age
String position
String name
String address
boolean isMale (or String gender)
class Company
String name
String address
Vector employees
class RealLife
// do stuff

Bill
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mighty Miramichi,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic