Can give answer to the folloing questionQuestion 2You are in charge of implementing a Grand Prix Car Racing Results system for a sports magazine, to be used for entering and processing data concerning each Formula 1 Grand Prix that has been run in the season.As you know, each driver is part of the team, and has a number. At the end of each race, the driver who arrived first is assigned 9 points, and the following five drivers receive 6,4,3,2 and 1 point each. Drivers who come in after the sixth position do not score any points.Some features of the main application class (the GRANDPRIX class) are show in Figure 6 (on page 13). The main application data arrays are populated from and saved in a relational database. Arrays drivers and teams contain lists of all drivers and teams participating. Array races contains details of all races run so far.Class Race contains linked list of Placement objects, each corresponding to a driver who took part in the race. The Placement objects are placed in the linked list in order of arrival. Some details of the Race and Placement classes are shown in Figure 5 (on page 13). Some details of the Driver and Team classes are also given.(a) Class Placement has a creation routine:public Placement (Driver d, int timeTaken, Boolean hasCompleted)which is called by the main data entry routine at the end of a race. Write the code for this routine.(b) In class Race, write a routine:public int getTeamPoints (Team t) { … }which return the total number of points gained in the race by a particularteam t. Assume the placements data for the race is fully entered.(c) In the main application object, a printout of the overall point situation for all teams is required. For each team, the score at each race where points were gained is detailed, and the total score is given. An example of such a printout is shown in Figure 7 (on page 14). In class GrandPrix, write a routine :public void printTeamPoints () { …. }that will perform this task. The order in which teams are shown need not depend on points. Figure 5: Fragment from classes Race, Placement, Driver and Team.Import java.util.* ;public class Race { private String name; // E.g. Italy, South Africa, Malaysia etc private Date date; private Vector orderOfArrival; //Container for the placements private static int points() = { 9,6,4,3,2,1}; ……..}public class Placement { private Driver driver; private Team team; private int timeTaken; private Boolean hasCompleted; …….}public class Driver { private String name; private String country; private Team team; private int number; // The competitor number on the car …….}public class Team { private String name; // E.g. McLaren, Benetton, Ferrari, etc private String country; …..} Figure 6 : Fragment from the Main Application Object.public class GrandPrix {feature private Driver drivers(); private Team teams(); private Race races();}Figure 7 : Sample output for routine print_team_points.Benetton Argentina – 10 points Germany – 3 points Brazil – 7 points ** TOTAL : 20 points **McLaren Argentina – 3 points Italy – 7 points Germany – 6 points Brazil – 10 points ** TOTAL : 26 points **Old Bangers ** TOTAL: 0 points **Ferrari Italy – 5 points Germany – 2 points ** TOTAL : 7 points **……..

Questions by hari2

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions