Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Programming: The GolfTeam class has a teamName (String), schoolName (String

ID: 3756031 • Letter: J

Question

Java Programming:

The GolfTeam class has a teamName (String), schoolName (String) and a roster/list of Golfers. The roster is implemented using an ArrayList of Golfer objects. Answer the following questions assuming you already have a fully implemented Golfer class.

A. Show the Java code for the GolfTeam class header and the property definitions.


B. Show code for a no-arg constructor that initializes the first two properties to “Panthers” and “College”. The constructor also instantiates the roster ArrayList but leaves it empty.


C. Show the code for the getter and setter methods for the teamName property.

Explanation / Answer

//////////////////part A

import java.util.ArrayList;
public class GolfTeam {
String teamName;
String schoolName;
ArrayList<Golfer> roster ;
  
}

//////////////////////////////part B

GolfTeam()
{
teamName="Panthers";
schoolName="College";
roster=new ArrayList<Golfer>();
}

/////////////////////partC

void setteamName(String teamName)
{this.teamName=teamName;
}
String getteamName()
{
return teamName;
}

//////////////////fullcode


import java.util.ArrayList;
public class GolfTeam {
String teamName;
String schoolName;
ArrayList<Golfer> roster ;
  
GolfTeam()
{
teamName="Panthers";
schoolName="College";
roster=new ArrayList<Golfer>();
}
  
void setteamName(String teamName)
{this.teamName=teamName;
}
String getteamName()
{
return teamName;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote