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

How to passing parameters to applets, How to Passing Parameters to Applets ...

How to Passing Parameters to Applets ? Parameters are passed to applets in NAME=VALUE pairs in tags among the opening and closing APPLET tags. Inside the applet, you read th

Explain pop, SMTP (Simple Mail Transfer Protocol) permits two mail servers ...

SMTP (Simple Mail Transfer Protocol) permits two mail servers to communicate using a easy language, and gives a step-by-step protocol for exchanging information. SMTP delivers m

State the verify phase of java program development, State the Verify phase ...

State the Verify phase of Java Program Development Before the bytecodes in an application are executed by the java interpreter, they are verified by the bytecode verifier in

How to get data from the velocity page in a action class, We can get the va...

We can get the values in the action classes by using data.getParameter("variable name described in the velocity page");

Conditional statements in javascript, Very frequently when you write code, ...

Very frequently when you write code, you desire to perform distinct actions for different decisions. You can employ conditional statements in your code to do this. In JavaScript

Print the percentage of each nucleotide, 1. In this lab assignment we will ...

1. In this lab assignment we will be using the vim or emacs editor in addition to the commands we have already learned. Open a shell terminal and create a file named in your home d

We require expert programmers who will solve problems, We require expert pr...

We require expert programmers who will solve problems, who can code by the book, and who will code in java and JavaScript what is designed. Skills required: CSS, Java, HTML5,

Web-based client program, Why are JSP pages the preferred API for creating ...

Why are JSP pages the preferred API for creating a web-based client program? Because no plug-ins or security policy files are required on the client systems (applet does). Also,

Write a code in java to explain the while loop in java, Write a code in jav...

Write a code in java to explain the while loop in Java? // This is the Hello program in Java class Hello { public static void main (String args[]) { System.out.print("

Need to modify joomla component, Project Description: I want to modify J...

Project Description: I want to modify Joomla component. Now there is Akeeba subscription component on this site. It works and the whole thing is fine, but there is no "teaser

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