Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide the java code for the above question. Please dont post the code as images. 2 Define an abstract class Themepark' and inherit 2

image text in transcribedimage text in transcribed

Please provide the java code for the above question. Please dont post the code as images.

2 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 Testcase 1 Output 4 5 6 7 8 20 5 7 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 Input Testcase 2 Output 4 5 6 7 8 20 5 7 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

1. Which position would you take?

Answered: 1 week ago