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

Create a link list iterator, In this assignment, you will gain experience i...

In this assignment, you will gain experience implementing the java.util.List interface. This includes writing an inner class called Node and another inner class called CS228LinkedL

Socket programming in Java: TCP, Objectives: socket programming in Java: TC...

Objectives: socket programming in Java: TCP Exercises: Goal: In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web ser

Area of the curve, program t ofind area under the curve y=f(x) between x=a ...

program t ofind area under the curve y=f(x) between x=a and x=b integrate y=f(x) between the limits a and b

Implement decision tree algorithm using netbeans, Implement Decision Tree A...

Implement Decision Tree Algorithm using Netbeans (Java) & Microsoft Access 2007. "One Level is enough, output should contains gain of each attribute, the selected attribute and

What is numeric promotion, What is numeric promotion? Numeric promotion...

What is numeric promotion? Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place.

What are the difference between throw and throws, What are the difference b...

What are the difference between throw and throws? Differences are between throws and throw are: Throw is employed to trigger an exception while throws is used in declara

Image caching with html, In the airplane program, you may have noticed that...

In the airplane program, you may have noticed that the loading of each image appears to be jerky, erratic, or slow, and that the URL for each image flickers in the status bar each

What do you mean by auto wiring, The Spring container is able to autowire r...

The Spring container is able to autowire relationships among collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for

Explain the rules for tostring() methods, Explain the Rules for toString() ...

Explain the Rules for toString() Methods ? toString() methods should return a single line of text that does not contain any carriage returns or linefeeds. toString() methods

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