CaveExplorer Project: Teacher Edition
This is a Java project, but don't worry! It is designed for every one, even if you have never coded before.
Before we begin, I will demonstrate a few examples. Essentially, "CaveExplorer" is a text-based adventure. Each member of our PD will code one cave in the cave system. The navigation of the cave and the output has already been programmed by me. In this project, we will exercise the principle of "inheritance" that extensions of objects inherit the behaviors of their parents. Specifically, you will make an extension of the pre-programmed CaveRoom. The inherited behaviors will be all of those behaviors that are required for the game to run, your job is to program "the flavor". If you are more experienced, you might even add a few functions of your own, as you will see in the examples.
You have two fundamental jobs, which this tutorial leads you through. Anything else is extra:
1. Create a class file with the name "YourNameRoom." This type of writing is called "CamelCase" because spaces are not allowed in file names. Your class will extend the class "CaveRoom".
2. In all of the required methods, return a String.
Below is the map of the relative positions of everyone's room. (If a person is absent, they will be replaced with a default room.)
Create a new class in the package called "customRooms". To create a new class in a certain package, right click on the customRooms package and select New> Class.
If you cannot find the Package Explorer, from the menu bar, select Window> Show View> Package Explorer.
For the Name, use your first name, followed by Room, in camel case: "YourNameRoom." For example, I would use 'BenjaminRoom'. If there is more than one person in the room with your name, use your last name. (I will let you know if this is the case.)
Click on the "Browse" button next to the Superclass field. This will open another dialogue box.
Begin to type "CaveRoom". Before you finish typing, the word should appear in the list below. Click "OK".
Before you click 'Finish' verify the dialogue box look like the image on the right. Note that two of the checkboxes at the bottom are checked.
The resulting file will look like this. Note that the class already extends CaveRoom. Each of the methods represents a required method that I programmed into CaveExplorer. Your task is to return a String in each place where the word 'null' is found.
In Java, a line of code ends with a semicolon. Furthermore, a String must be in quotation marks. (A word that is not in quotation marks is treated like a variable or method call.)
For further reference...
I have written four example classes and an example program. The example classes are appropriately named 'Basic', 'Intermediate' and 'Expert' (The two expert classes represent the work of two people who worked together.)
To view one of these examples, expand the 'example' package and double-click on a class. It will open in a tab in the main viewer. You can switch between files by clicking each tab.
To execute the program, open the 'ExampleGame' file and click the green play button in the toolbar menu or right-click ExampleGame and select "Run As...> Java Application"