Hello,
I have a problem with this method:
public boolean addRaceDrivertoTeam(String driverLicenseNumber,String
nationality,String constructorName, String fullName, Date dateOfBirth
, int worldChampionships, int totalScore, int highestRaceFinish){
RaceDriver driver = new RaceDriver(driverLicenseNumber,fullName,nationality,
dateOfBirth,worldChampionships,totalScore, highestRaceFinish);
Constructors con;
con = Constructors.valueOf(constructorName);
RaceTeam team= new RaceTeam(con);
if (driver.getRaceDriverKey()!=null)
if (raceTeam.containsKey(con)&&(driver != null) &&
!team.isDriverExists(driver)){
team.addRaceDriver(driver);
return true;
}
return false;
}
This method should add RaceDriver to Team, the method word correctly, but there is one mistake.
every Team can include just at 3 drivers .
I didn't know how I can limit it/
i try limit it from the addRaceDriver() method that in the RaceTeam class but i didn't succed.
this is the addRaceDriver() method:
public boolean addRaceDriver(RaceDriver driver){
if (raceDriver != null && !raceDriver.containsKey(driver.getRaceDriverKey())){
raceDriver.put(driver.getRaceDriverKey(), driver);
return true;
}
return false;
}
anyone can help me how to do this ?