Hi! Could you please help me: PART 1: the TeamData class specifications A. the T
ID: 3565577 • Letter: H
Question
Hi!
Could you please help me:
PART 1: the TeamData class specifications
A. the TeamData class (save in a file: TeamData.java
1) This class is a very small class with the following structure:
Private data members (instance variables)
integers: x, y (x, y coordinates to draw the logo in the grid)
ImageIcon: logo1; // a team logo icon
String: teamName, price, souvenir;
Constructor:
One non-default constructor, pass in as parameters: (no data validation)
The ImageIcon object, an int x and int y screen location, and all Strings
Assign to the private data members, the parameter values passed in
Methods:
getLogo1: returns the first InageIcon object
getX: returns the x coordinate value
getY: returns the y coordinate value
a get method for each String: teamName, price, souvenir;
2) Code the class, compile and debug.
Explanation / Answer
/*Save as TeamData.java*/
import javax.swing.ImageIcon;
public class TeamData {
//data members of the class
private int x;
private int y;
private ImageIcon logo1;
private String souvenir;
private String price;
private String teamName;
//constructor to assign values to all data members
public TeamData(int x, int y, ImageIcon l, String s, String p, String t){
this.x = x;
this.y = y;
this.logo1 = l;
this.souvenir = s;
this.price = p;
this.teamName = t;
}
public ImageIcon getLogo1(){ // returns the first InageIcon object
return logo1;
}
public int getX(){ // returns the X coordinate
return x;
}
public int getY(){ // returns the Y coordinate
return y;
}
public String getSouvenir(){ //returns souvenir string
return souvenir;
}
public String getPrice(){ //returns price string
return price;
}
public String getTeamName(){ //returns team name
return teamName;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.