我有一个类StaffData 然后当我要加值进去的时候我怎么样将两个人的信息分两行显示
package tma02q3jan2007;
//29 Mar 07
import java.util.*;
public class StaffData {
// instance variables, if any
Vector fultimeHolder;//collection to hold fulltimestaff data
Vector partimeHolder;//collection to hold parttimestaff data
FullTimeStaff fts;//create fulltimestaff
PartTimeStaff pts; //create parttimestaff
public StaffData() {
this.fultimeHolder=new Vector(50);//will be enough if 50 ful_time staff
this.partimeHolder=new Vector(50);//will beenough if 50 part_time staff
// Java statements, if any
}
public double getTotalSalary(String category){
/* This method should return the total salary of either all part time staff or
all full time staff, depending on the input argument */
if(category.equals( "FULLTIMESTAFF ")){
double totalSalaryFul=0;
Enumeration fulEnu=fultimeHolder.elements();
FullTimeStaff tempful=new FullTimeStaff( " ", " ", " ",0,false) ;
while(fulEnu.hasMoreElements())
{tempful=(FullTimeStaff)fulEnu.nextElement();
totalSalaryFul=totalSalaryFul+tempful.getSalary();
}
return totalSalaryFul;
}
else if(category.equals( "PARTTIMESTAFF ")){
double totalSalaryPar=0;
Enumeration parEnu=partimeHolder.elements();
PartTimeStaff temppar=new PartTimeStaff( " ", " ", " ",0);
while(parEnu.hasMoreElements())
{temppar=(PartTimeStaff)parEnu.nextElement();
totalSalaryPar=totalSalaryPar+temppar.getSalary();
}