Define a subclass of tournaments called collegegames the


True or False Questions: Please answer the following questions either "true" or "false If, our answer is false, correct the statement so that it is true.

1. A class is a container for holding static member variables and methods. A class is also used like a blueprint to construct objects.

2. While there may be many objects constructed from a class, there can be only one of each type of class.

3. A variable can hold only a reference to an object. By reference, we mean the memory address where the object is located.

4. A constructor cannot have the same name as the class in which it is defined.

5. The word create is used to construct objects, as in the following example:

ClassType myObject = create ClassType();

6. A constructor has a return type.

7. Many constructors can be defined for the same class, as long as their signatures are different from one another.

8. It is legal to use a non-static member variable in a static method, but it is not legal to use a static member variable in a non-static method.

9. An object knows to which class it actually belongs because information about the actual class of the object is stored as part of the object's construction.

10. The word extends is used to create subclasses.

11. A class can have many immediate/direct superclasses.

12. A variable that can hold a reference to an object from class A can also hold a reference to an object from any subclass of class A.

Questions 13 through 23 relate to the class defined in Problem 13.

13. A tournament organizing company wants to automate parts of its database. As part of its software, a Tournaments class has been created. For the following class definition, indicate which member variables and methods belong to the class and which belong to objects constructed from the class.

class Tournaments (
private static int numBasketball; private static int numVollcyball; public String eventNamc;
public int numGames;
public String monthHcld;
// constructors would go here
public static int getNumBasketballa {
return numBasketball;
}
public static int getNumVollcyball() ) { return numVolleyball; 'a
public String idLevel0fPlay () {
String x null;
return x;
}
}

14. Suppose that a subclass of Tournaments is defined.

a. Can it include additional member variables that are not included in the superclass Tournaments?

b. Can it exclude any of the member variables that are included in Tournaments?

c. Can it include additional member methods that are not included in Tournaments?

d. Can it modify any of the member methods that are included in Tournaments%

15. Write the definition for a default constructor for the class Tournaments. The constructor should initialize the variable eventName to "Mid-West Regional Basketball", numGames to 15, and monthHeld to "March", respectively. Include means for updating any state variables that need to be updated.

16. Write the definition for a constructor for the class Tournaments, whereby the variables eventName and numGames are initialized according two parameters, eventName and numGames, respectively. Again, include menus for updating any stale variables that need to be updated. To do so, use a third parameter to distinguish whether an event is basketball or volleyball, so Maybe state variables are correctly updated.

17. What is the value to which monthlield is initialized in (16) above?

18. Call the default constructor in Problem 15 to construct a type Tournaments object called event 1.

19. Call the constructor with parameters in Problem 16 to construct a type
Tournaments object called event2. The event name should be "State H.S. Women's Volleyball", and the number of games (matches in this case) should be 31.

20. Construct an array of type Tournaments objects. The array should have 4 elements. Use the default constructor.

21. Define a subclass of Tournaments called CollegeGames. The subclass should include an additional member having type String and visibility public. The name of the member variable will be "sponsor". Modify idLevel0fPlay so that the second line in the method reads as follows:
Sting x "CollegeGames";

22. Suppose that another subclass of Tournaments is called HighSchoolGames. Suppose that a type CollegeGames object and a type HighSchoolGames object have been constructed. If the first object is called collegel and the second object is called
hsl, construct an array that can hold both of these objects. Store the objects in the array, using a means that you have learned.

23. Using array notation, how would you print the name of the subclass from which each element in the array arose'?

24. What will the following print?

Int[] myArray an new int[3];
for (int i = 0; i < myArray.length; ++i) { myArray[i] = i +3;
int x = 5;
myFunction (myArray, x );
System.outprintin (myArray[1]);
System.out.println (x);
myFunction ( myArray, x );
System.out.println(myArray[1])
System.out.println(x);
if myFunction is defined to be as follows?
public static void myFunction(inta al, int xi) ( a1[1]+= 1;
xl += 2;
}

25. List all the different ways that you can extract information from a function. One is print statements to standard out (your monitor) or a file. There are at least three others.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Define a subclass of tournaments called collegegames the
Reference No:- TGS01387523

Expected delivery within 24 Hours