Define an abstract class Themepark' and inherit 2 classes 'Queensland' and 'Wonderla' from the abstract class. In both the theme parks, the entrance fee for adults is Rs. 500 and for children it is Rs. 300. If a family buys 'n' adult tickets and 'm' children tickets, define a method in the abstract class to calculate the total cost.
Also, declare an abstract method playGame() which must be redefined in the subclasses. In Queensland, there are a total of 30 games. Hence create a Boolean array named 'Games' of size 30 which initially stores false values for all the elements. If the player enters any game code that has already been played a warning message should be displayed and the user should be asked for another choice. In Wonderla, there are a total of 40 different games. Thus create an integer array with 40 elements. Here, the games can be replayed, until the user wants to quit. Finally display the games played as shown in sample output.
Input Format
First line of input consists of Theme park code (1 for Queensland and 2 for Wonderla) Second line of input consists of games played
Output Format
Welcome message in first line followed by games played details as shown in sample outputs
Sample Testcases
Testcase 1 Input
1
4 5 6 7 8 20 5 7
Testcase 1 Output
Welcome to Queensland! Playing game 4 at Queensland
Playing game 5 at Queensland
Playing game 6 at Queensland
Playing game 7 at Queensland
Playing game 8 at Queensland Playing game 20 at Queensland
You have already played game 5 You have already played game 7
Testcase 2 Output
Welcome to Wonderla!
Playing Game 4 at Wonderla
Playing Game 5 at Wonderla
Playing Game 6 at Wonderla
Playing Game 7 at Wonderla
Playing Game 8 at Wonderla Playing Game 20 at Wonderla
Playing Game 5 again at Wonderla Playing Game 7 again at Wonderla
Testcase 2 Input
2
4 5 6 7 8 20 5 7
Answers
Answer:
pls answer no problem how long it may be
Answer:
A limited class called an abstract cannot be used to create objects (to access it, it must be inherited from another class). Only applicable in an abstract class, an abstract method lacks a body. The subclass provides the body (inherited from).
Explanation:
Step : 1 Similar to conventional classes, abstract classes can have constructors. Additionally, we may use the super keyword in the subclass to access the function Object() { [native code] } of an abstract class. For instance, the limited class Animal (Abstract class) cannot be used to generate any objects (to access it, it must be inherited from another class). Only applicable in an abstract class, an abstract method lacks a body. The subclass provides the body (inherited from).
Step : 2 It is impossible to instantiate an abstract class. An abstract class's function is to offer a standard specification of a base class that many derived classes can use. Simply use the abstract keyword in front of the class keyword in the class declaration to create an abstract class. You can see that, except from abstract methods, the Java Employee class is identical to other classes. The class still contains three fields, seven methods, and one function Object() { [native code] } even if it is abstract now.
Step : 3 Adult admission to either theme park costs Rs. 500, while child admission is Rs. 300. Create a method in the abstract class to determine the total cost if a family purchases 'n' adult tickets and'm' kid tickets. by way of the abstract class. Adult admission to either theme park costs Rs. 500, while child admission is Rs. 300. Create a method in the abstract class to determine the total cost if a family purchases 'n' adult tickets and'm' kid tickets.
Declare an abstract method called playGame() as well, which the subclasses must rewrite.
There are a total of 30 games in Queensland. Create a Boolean array called "Games" with a capacity of 30 and an initial storage of false values.
To learn more about similar questions visit:
https://brainly.in/question/10634904?referrer=searchResults
https://brainly.in/question/24943052?referrer=searchResults
#SPJ3