Define a subclass of tournaments called collegegames

Assignment Help JAVA Programming
Reference no: EM131041635

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.

Reference no: EM131041635

Questions Cloud

Convert the following string to uppercase : -Write two assembly language programs one using regular instructions (not string instructions) and one using string instructions. The program should copy the string in problem-1 to another location and then compare the original and copied string t..
Customer service responsbilities of natural gas : An important part of the customer service responsbilities of a natural gas utility company concerns the speed with which calls relating to no heat in a house can be serviced. Suppose that one service variable of importance refers to whether or not th..
Using knowledge management and business intelligence : Using knowledge management and business intelligence, you will explore the opportunities for this level of IS support at Dirt Bikes USA. Your memo for this assignment will focus on identifying the knowledge assets, knowledge needs, and knowledge mana..
Estimate of the maximum value of the kidman properties : FINA3324 Assignment 2016. Provide your estimate of the maximum value of the Kidman properties that DomaCom should pay. The maximum price is the price at which you think an investment via DomaCom's crowdfunding campaign is not worthwhile
Define a subclass of tournaments called collegegames : Define a subclass of Tournaments called CollegeGames. The subclass should include an additional member having type String and visibility public.
Key changes and their evidence : Watch "The English Language Arts Standards: Key Changes and their Evidence" and "The Mathematics Standards: Key Changes and Their Evidence."
Develop a program that accepts the car registration : Develop a program that accepts the car registration
Calculate the average wait time : Assume that a hospital has a single-phase, multiple-channel waiting line. There are two employees, and new patients arrive at the rate of approximately 40 patients per hour. Calculate the average wait time.
Absent an applicable routine use : Beauregard is a high level employee of the Department of State. Recently, he has been using official travel for trips to a number of locations around the world, where, coincidentally, there are beautiful beaches, including Rio de Janeiro, Tahiti, St...

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a driver class with a main method

Create a driver class with a main method that creates a course, adds several students, prints a roll, and prints the overall course test average

  Write the flow of execution of application

Write the flow of execution of application step by step and briefly explain the functionality of each function being called (like the first step would be to instantiate Frame and then instantiate Panel and place it into the Frame).

  Write a program that shows the current time and date

Write a program that shows the current time and date

  Method level comment

What type of information should be included in a method level comment?

  Provides a method named ispalindrome

Write a complete Java program that provides a method named isPalindrome, which takes aQueue of integers as a parameter and returns true if the numbers in the Queue represent a palindrome (and false otherwise). The empty Queue should be considered ..

  Declare a subclass of jpanel called mycolorchooser

Display the current value of each JSlider in the corresponding JTextField. When the user changes the value of the JSlider, the JTextField should be changed accordingly.

  Is it possible to increase/decrease the diameter of circle

GeneralPath star = new GeneralPath(GeneralPath.WIND_EVEN_ODD, xPoints.length); // create GeneralPath object

  Determine the length of a string

Determine the length of a string. The first version should use array subscripting, and the second version should use pointer arithmetic

  Write a java class that creates an array of integers

Write a Java class that creates an array of integers, fills it with values, prints the unsorted values, sorts the values into ascending order, and finally prints the sorted values.

  Write java program to reverse contents of original array

Write down the Java program method named reversal which returns the new array which is a reversal of original array. Use [5.0, 4.4, 1.9, 2.9, 3.4, 3.5] to test method.

  Describe the graphical coordinate system in java

Describe the graphical coordinate system in Java. Where is the origin? What units apply to the x,y coordinates

  Produce a java implementation of the gui

For your Assignment 2 Part 1 submission you are required to produce a Java implementation of the GUI for the Agriculture image viewer component of your overall Agriculture File Storing and Management (FSM) System.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd