You are interested in keeping track of the team members and competition informat
ID: 3537591 • Letter: Y
Question
You are interested in keeping track of the team members and competition information for your school%u2019s annual entries in computer science programming competitions. Each team consists of exactly four team members. Every year your team competes in two competitions. As an initial start for your database, create a class named Team that has the following instance variables:
// Name for the team
String teamName;
// Names for each team members
String name1, name2, name3, name4;
//info on each competition
Competition competition1, competition2;
The class should also have a method that outputs all the names of all team members and the competition information to the console.
The Competition class contains variables to track the following:
String: Name of the competition, Name of the winning team, Name of the runner-up
Integer: Year of the competition
Implement the Team and Competition classes with appropriate constructor, accessor, and mutator methods. In entering data for past competitions, you note that an entry is usually very similar to the previous year%u2019s entry. To help with the data entry, create a deep copy constructor for the Team class. Test your copy constructor by creating a copy of an existing team object, changing the competition information for the copy and outputting the data for the original and the copy. The original object should be unchanged if your deep copy constructor is working properly.
Explanation / Answer
The assignment is poorly written but I think I get the gist.
The class "Team" would be:
String teamName;
String name1, name2, name3, name4;
Competition competition1, competition2 /*this is a Competition class, which you'll have to create */
then in the Team you have to make a get and set method, as well as a method that outputs the team members and information from your Competition class object (i.e. competition1.property)
The Competition class would have:
String compName, compWinner, compNotSoWinner;
Integer Year; /*bad teacher! never use an int for a date! use a date object!*/
So what you have to do is make the get, set methods for these, as well as constructors. You then have to instantiate a Team object, give it data, and a Competition object, and give it data. The Team object you'll have will need to accept the Competitions as arguments in the constructor.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.