subject
Computers and Technology, 22.04.2020 02:55 jmalfa

Create a class named BaseballGame that contains data fields for two team names and scores for each team in each of nine innings. names should be an array of two strings and scores should be a two-dimensional array of type int; the first dimension indexes the team (0 or 1) and the second dimension indexes the inning. Create get and set methods for each field. The get and set methods for the scores should require a parameter that indicates which inning’s score is being assigned or retrieved. Do not allow an inning score to be set if all the previous innings have not already been set. If a user attempts to set an inning that is not yet available, issue an error message. Also include a method named display in DemoBaseballGame. java that determines the winner of the game after scores for the last inning have been entered. (For this exercise, assume that a game might end in a tie.) Create two subclasses from BaseballGame: HighSchoolBaseballGame and LittleLeagueBaseballGame. High school baseball games have seven innings, and Little League games have six innings. Ensure that scores for later innings cannot be accessed for objects of these subtypes.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 12:30, kayleigh2037
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
image
Computers and Technology, 23.06.2019 09:10, babyskitt
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
image
Computers and Technology, 24.06.2019 10:30, pino40
Which of the following types of software is most applicable to the promotion of new products through advertising? a. databases b. spreadsheets c. web design programs d. word processing tools
Answers: 2
image
Computers and Technology, 25.06.2019 13:00, eparikh7317
Which professional is an example of a person who belongs to the social elite in the united states
Answers: 1
You know the right answer?
Create a class named BaseballGame that contains data fields for two team names and scores for each t...

Questions in other subjects:

Konu
Mathematics, 27.04.2021 22:20
Konu
Mathematics, 27.04.2021 22:20