Question: Create an enum Direction: 1: Create an enum in the edu.waketech.ccave.common package called Direction . This enum has the following values: N, S, E, W,
Create an enum Direction:
1: Create an enum in the edu.waketech.ccave.common package called Direction. This enum has the following values: N, S, E, W, NE, NW, SE, SW, UP, DOWN, UNKNOWN.
2: In the resources directory, create a properties file for each direction except UNKNOWN. For example, resources will contain a file n.properties. This file will contain a series of synonyms for Direction.N, where the property key is meaningless and the property value is a synonym for N, for example, "north". So n.properties would have at least one line n=north A properties file may contain more than one synonym. For example, in the properties file for Direction.UP (up.properties) you wish to define up=u up1=higher
Note that even though we don't care about the keys in the properties file, they have to be unique.
At a minimum, define long forms for each direction:
| enum value | long form synonym |
| N | north |
| S | south |
| E | east |
| W | west |
| NW | northwest |
| NE | northeast |
| SW | southwest |
| SE | southeast |
| UP | u |
| DOWN | d |
You may add other synonyms as you wish.
: The Direction enum has an instance variable of type ArrayList that holds the enum's given synonyms from the corresponding properties file information.
4: The Direction enum's constructor reads the associated properties file from the resources directory and adds the synonyms to the ArrayList instance variable.
Implement the Direction enum described of the Colossal Cave Adventure Project. Zip the resulting resources andsrc directories into a single zip file and submit it to the lab dropbox elsewhere in this folder. Note that this zip file will have many directories included in it. This is unlike the submissions you may have made in my classes previously. Its internal structure will be something like
zipFile
resources
lots of properties files
src
edu
and so on, with, ultimately, Direction.java in its proper package/directory, and its tester in the test package
Grading Elements:
all packages and resources directories properly created
Direction enum created in the proper package
Direction has all the specified values
Resources directory contains a properties file for each direction (except UNKNOWN)
Each properties file has at least one appropriate synonym
Direction tester is present, tests both the values and synonyms of the Direction enum, and is in the test package.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
