Hope someone can help, for an assignment i was given a starter application
package, with that starter package i had to create some employee classes and
test harnesses. below iv pasted my Container class, which holds a company
eomployee class , the Company class and the Data holding class. I am
somehow trying to pass the container class into the preset frame as seen in
the attached file (Jdeveloper package file)
hope someone can give some ideas, or examples i can work with.
thanks in advance.
Company Class:
public class Company extends Employee {
private String jobTitle;
private String startDate;
private String leavingDate;
private double salary;
public Company(String aName, String aAddress, String aEmail,
String aTelephone, String aTelExt, String aJobTitle ,String
aStartDate, String aLeavingDate
, double aSalary){
super();
this.name = aName;
this.address = aAddress;
this.email = aEmail;
this.telephone = aTelephone;
this.telExt = aTelExt;
this.jobTitle = aJobTitle;
this.startDate = aStartDate;
this.leavingDat e = aLeavingDate;
this.salary = aSalary;
}
public String toString(){
return ("Name : "+ name + " -\n Address: " + address
+ "-\n Email: " + email + "-\n Telephone: "
+ telephone + "-\n ID:" + idNo + "-\n Jobtitle: "
+ jobTitle + "-\n StartDate: " + startDate + "-\n Leaving Date: "
+ leavingDate + "-\n Salary: " + salary);
}
}
Container Class:
public class CompanyContaine rClass extends Object {
private static Vector company = new Vector();
public int getItemCount(){
return company.size();
}
public Company getString(int index){
return (Company)compan y.elementAt(ind ex);
}
public void addString(Compa ny newString){
company.add(new String);
}
public void addElement(Comp any newString){
company.addElem ent(newString);
}
}
Data Holding Class/ pass to container :
public class CompanyDataClas s extends Object {
public static CompanyContaine rClass c = new CompanyContaine rClass();
public static void buildCompanyObj ects() {
Company company1 = new Company(
"Shaun Marshall"
,"East Kilbride"
,"shaun.marshal l@blueyonder.co .uk"
,"265461"
,"229"
,"Chef De Parte"
,"06/10/02"
," "
,13500d);
Company company2 = new Company(
"Donald Duck"
,"33Boat Pond"
,"donald@duckla nd.com"
,"236699"
,"221"
,"Security"
,"11/04/00"
,"23/02/03"
,8500d);
Company company3 = new Company(
"George Bush"
,"The White House"
,"georg@thewhit eouse.com"
,"02699 555"
,"666"
,"Diplamatic Ambasidor"
,"01/01/99"
," "
,21000d );
Company company4 = new Company(
"Lorna Marshall"
,"Appleby Close"
,"lorna.marshal l@ntl.com"
,"265461"
,"369"
,"Facilities Manager"
,"01/03/01"
," "
,23000d);
c.addString(com pany1); // Company objects are referenced by the
c.addString(com pany2); // CompanyContaine rClass
c.addString(com pany3);
c.addString(com pany4);
for (int i = 0 ; i < c.getItemCount( ); i ++) {
System.out.prin tln(c.getString (i));
}// prints all items in the Container
package, with that starter package i had to create some employee classes and
test harnesses. below iv pasted my Container class, which holds a company
eomployee class , the Company class and the Data holding class. I am
somehow trying to pass the container class into the preset frame as seen in
the attached file (Jdeveloper package file)
hope someone can give some ideas, or examples i can work with.
thanks in advance.
Company Class:
public class Company extends Employee {
private String jobTitle;
private String startDate;
private String leavingDate;
private double salary;
public Company(String aName, String aAddress, String aEmail,
String aTelephone, String aTelExt, String aJobTitle ,String
aStartDate, String aLeavingDate
, double aSalary){
super();
this.name = aName;
this.address = aAddress;
this.email = aEmail;
this.telephone = aTelephone;
this.telExt = aTelExt;
this.jobTitle = aJobTitle;
this.startDate = aStartDate;
this.leavingDat e = aLeavingDate;
this.salary = aSalary;
}
public String toString(){
return ("Name : "+ name + " -\n Address: " + address
+ "-\n Email: " + email + "-\n Telephone: "
+ telephone + "-\n ID:" + idNo + "-\n Jobtitle: "
+ jobTitle + "-\n StartDate: " + startDate + "-\n Leaving Date: "
+ leavingDate + "-\n Salary: " + salary);
}
}
Container Class:
public class CompanyContaine rClass extends Object {
private static Vector company = new Vector();
public int getItemCount(){
return company.size();
}
public Company getString(int index){
return (Company)compan y.elementAt(ind ex);
}
public void addString(Compa ny newString){
company.add(new String);
}
public void addElement(Comp any newString){
company.addElem ent(newString);
}
}
Data Holding Class/ pass to container :
public class CompanyDataClas s extends Object {
public static CompanyContaine rClass c = new CompanyContaine rClass();
public static void buildCompanyObj ects() {
Company company1 = new Company(
"Shaun Marshall"
,"East Kilbride"
,"shaun.marshal l@blueyonder.co .uk"
,"265461"
,"229"
,"Chef De Parte"
,"06/10/02"
," "
,13500d);
Company company2 = new Company(
"Donald Duck"
,"33Boat Pond"
,"donald@duckla nd.com"
,"236699"
,"221"
,"Security"
,"11/04/00"
,"23/02/03"
,8500d);
Company company3 = new Company(
"George Bush"
,"The White House"
,"georg@thewhit eouse.com"
,"02699 555"
,"666"
,"Diplamatic Ambasidor"
,"01/01/99"
," "
,21000d );
Company company4 = new Company(
"Lorna Marshall"
,"Appleby Close"
,"lorna.marshal l@ntl.com"
,"265461"
,"369"
,"Facilities Manager"
,"01/03/01"
," "
,23000d);
c.addString(com pany1); // Company objects are referenced by the
c.addString(com pany2); // CompanyContaine rClass
c.addString(com pany3);
c.addString(com pany4);
for (int i = 0 ; i < c.getItemCount( ); i ++) {
System.out.prin tln(c.getString (i));
}// prints all items in the Container