Inheritance and interfaces to construct type hierarchies, JAVA Programming

Assignment Help:

Objectives

1. To help you become comfortable with using inheritance and interfaces to construct type hierarchies.

2. To familiarize you with programming from specifications.

As per usual practice, any input files will be placed in the same directory as your program during grading. (Don't forget how Eclipse/NetBeans handle these things if you use one of those IDEs.)
Problem: Adventurer Assistance, Inc.

Fresh from your successful internship with the famed explorer Tallahassee Smith, you've spotted a market opportunity and decided to go into business for yourself. Your startup, Adventurer Assistance, provides online guidance to teams of adventurers in sticky situations. Your first contract involves providing mission control for teams of three exploring underground cave systems suspected to have been built by aliens, dwarves, the Great Old Ones, or perhaps even all three. Their aim is to reach a treasure cache whose location they have identified. But first they need to navigate through the dark and treacherous caves, and helping them do that right is your job.

Your helpful assistants have already written a graphical user interface for your program, and provided a set of specifications for classes that you must write in order to make it work. When you're done, you'll be able to send commands to the three team members, simply by clicking on their icons and moving them around with arrows. This allows you to trick online gamers into guiding expeditions, by having them think they're playing a 2-D maze game instead.

In practical terms, you will not write a main() method at all, just the functionality that main() already expects in order to function. In effect, you're writing a library to be used by the prewritten GUI code.

The caves are laid out in a regular two-dimensional grid pattern, which you have named the Board. Each cell of the grid represents a single cave in the cave system. A cave is big enough to hold exactly one person (the builders were apparently rather small), and is connected to its four neighboring caves to the North, South, East and West.

However, not all caves are accessible. While some caves are open, others may have been blocked by a cave-in, and cannot be entered. Some others contain bottomless pits that will be the end of any unwary explorer that walks into them. And finally, certain caves are teleport locations that will instantly transport anyone who enters to a random open cave anywhere on the Board. These are especially problematic because we usually can't tell where they are, except by entering and getting teleported.

A team is composed of three people, with unique specialties:

1. Miner: A demolition expert. If he moves into a location with a cave-in, he will destroy the rocks blocking it off, converting it into an open cell.

2. Filler: A vertical descent safety specialist who can fill in bottomless pits. If he enters a location with a pit in it, the pit will be filled in and the cave will be considered open.

3. Adventurer: The intrepid leader of the expedition. She is the one who must reach the treasure cache in order to achieve mission success, because the other two don't look as good on camera, and 21st century adventuring is really all about the post-adventure merchandising deals. She is equipped with a cutting-edgeTeleport Interdiction System. As a result, if she enters a teleport location, she will not get teleported. Instead, that location will be marked on the Board, so that the other two can avoid it (or risk it, if necessary). Unfortunately, she can't enter blocked-off caves, and will be killed if she walks into a cave with a pit in it. If she dies, the mission ends, and is considered a failure.

Neither of these three can leave the cave - the boundaries are impenetrable. The only way out is to get the Adventurer to the treasure in the bottom-right corner of the Board.

At the start of the game, a random board is generated. (The reason for this is complicated, and involves a series of unfortunate accidents involving a time machine and a random number generator.) The Adventurer is at the top-left location, and the Miner and Filler are at random open caves on the Board, having gone in earlier. Such is life for a professional sidekick.

To model this situation, you must write the following set of classes. (See documentation for precise technical details on what you should implement.)

1. Cave: A class that represents a single cave. Its instance variables contain information on its position on the Board, the type of cave it is (open, blocked, pit, teleport), and various instance methods described fully in the docs.

2. Board: Represents the game board. It contains a 2-D array of Caves, and is responsible for generating a random cave system, among other things.

3. Character: An abstract base class representing members of the team. It handles common functionality, like moving from a cave to an adjacent cave and getting teleported if it contains a teleport location. The classesAdventurer, Miner and Fillerare descended from it, and override its methods to model their unique behavior.

4. Adventurer: A subclass of Character that represents the leader of the expedition. Incorporates the special ability to be immune to teleportation and mark teleport locations.

5. Miner: A subclass of Character that represents the miner, and incorporates his special ability to clear blocked caves.

6. Filler: A subclass of Character that represents the filler, and incorporates his special ability to fill up pits.

7. CaveWorker: An interface that represents the ability to change a non-open location to an open one (by filling a pit or blowing up rocks).

You will be provided with the main class AdventureGamethat will generate the game interface and handle input/output. You DO NOT need to alter this file for the normal assignment. (See the extra credit section below for the situation where you might want to alter it.)

The folders icons and icons64 provided for you must be placed in your project folder. The image files in them are used as part of the GUI.
Input/Output

You don't need to worry about input/output, this will all be handled by the prewritten classes we will provide.

Extra Credit (Optional)

An additional Webcourses assignment will be created, marked Assignment 4E. This is the extra credit assignment. On this one, you can add new features, overhaul the GUI, soup up the game in crazy ways - basically be as creative as you want. Up to 20 points of extra credit are available for this, which comes to 7 extra points added to your final grade at the end of class. We'll show off the coolest submissions in class.

NOTE:You still need to submit the original assignment! Please avoid adding extra features to the original one - reserve your creativity for the extra credit.

Deliverables

Submit the source files over Webcourses as an attachment. In particular, do not submit any .class files!!! This will result in 0 credit for the assignment. You must send your source files as an attachment using the "Add Attachments" button. Assignments that are typed into the submission box will not be accepted.
Restrictions

Your program must compile using Java 6.0 or later on the command line. Your programshould include a header comment with the following information:

Your name

Course number, section number

Short description of the code


Related Discussions:- Inheritance and interfaces to construct type hierarchies

Break statement, The break statement is utilized for terminating the curren...

The break statement is utilized for terminating the current While or For loop and after that transferring program control towards statement just after the terminated loop. The foll

What is jms message, An object that having the data being transferred among...

An object that having the data being transferred among JMS clients.

Explain all java primitive data types, Explain all Java Primitive Data Type...

Explain all Java Primitive Data Types? boolean 1-bit. May take on the values true and false only. true and false are describe constants of the language and are not the s

Add extra features to exciting minecraft plugin, Add extra Features to exci...

Add extra Features to exciting Minecraft plugin Project Description: I own a minecraft server and have a minigame plug-in but at the end of the game the map need to regenerat

Garbage collection in java, The Java programming language is object-oriente...

The Java programming language is object-oriented and includes automatic garbage collection. Garbage collection is the process of reclaiming memory taken up by unreferenced objects.

Java class loaders , Classes are attached into the JVM as they are referenc...

Classes are attached into the JVM as they are referenced by name in a class that is already running in the JVM. So, how is the staring class loaded? The very first class is espec

Explain the three benefits of access protection, Explain the Three Benefits...

Explain the Three Benefits of Access Protection ? Access protection has three major benefits: 1. It permits you to enforce constraints on an object's state. 2. It gives a si

What is an xml namespace?, Question 1 What is Response Redirection? Explai...

Question 1 What is Response Redirection? Explain in brief Question 2 What is JDBC? Explain Question 3 Write a short note on Expressions Question 4 What is an XML na

What is multiple inheritance, What is Multiple Inheritance ? A few obje...

What is Multiple Inheritance ? A few object oriented languages, notably C++, permits a class to inherit from more than one unrelated class. This is known as multiple inheritanc

Prepare a new fishing app, New Fishing App Project Description: A new...

New Fishing App Project Description: A new app for iPhone providing a GPS connected map of the fishery you are fishing at and other logged in users who are also fishing at th

Write Your Message!

Captcha
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