ObjectiveArrays are one of the ways that Java allows for storing items in a list. In this lab, we will gain experience creating and manipulating arrays. FilesThere are two files that you need to download for this lab.
You will need to create and submit a Descriptions.java file, for which we are not providing skeleton code. Customize Your GameThere are three lists that you will need to generate for this assignment: location names, location descriptions, and cargo names. Your choice will allow you to customize your game. Location namesThe first task you must choose is what names you would like for the locations. We have a number of ideas below, but feel free to choose your own. You must have about 20 locations names for this game to work properly.
Location descriptionsEach location will have a single adjective that describes that location. You should have about as many adjectives as locations (i.e. at least 20). Note that it's not necessary to have all of the adjectives be from a single category, like "weather".
Cargo namesLastly, you will need to come up with names of cargo. For example, you could buy and sell course textbooks at the UVa dorms. A few ideas of cargo types are listed below. You need to come up with at least 15 cargo types.
If you make up cargo types that are illegal (i.e. drugs), you will get a zero for this lab. We don't want to get fired because the class made up a game to buy and sell drugs... :^) The Descriptions ClassAll the members of the descriptions class are to be static -- thus, we need no constructors, accessors, or mutators. Attributes
Methods There are six methods that you need to create for this class. All of the methods should be public and static.
DescriptionGeneratorThis class will test all the methods in your Descriptions class. A sample execution output appears below. Don't worry if duplicate entries occur. There are 31 locations defined. There are 17 cargos defined. rainy Greenleaf has Cloth to sell at a cost factor of 1.0 heavily populated Georgia has Furniture to sell at a cost factor of 2.0 heavily populated Ariel has Medicine to sell at a cost factor of 3.0 mild Haven has Fuel to sell at a cost factor of 4.0 sunny Persephone has Medicine to sell at a cost factor of 3.0 heavily populated Whitefall has Cloth to sell at a cost factor of 1.0 crowded Georgia has Furs to sell at a cost factor of 2.0 sunny Persephone has Food to sell at a cost factor of 2.0 hilly Persephone has Furs to sell at a cost factor of 2.0 dull Ezra has Furs to sell at a cost factor of 2.0 rainy Ariel has Water to sell at a cost factor of 1.0 bland Athens has Cloth to sell at a cost factor of 1.0 dull Dyton has Platinum to sell at a cost factor of 10.0 wet Greenleaf has Robots to sell at a cost factor of 6.0 mountainous Regina has Robots to sell at a cost factor of 6.0 rainy Ariel has Silver to sell at a cost factor of 4.0 dull Triumph has Java textbooks to sell at a cost factor of 100.0 forested Verbena has Cloth to sell at a cost factor of 1.0 sunny Ita has Waste to sell at a cost factor of 1.0 sunny St. Albans has Water to sell at a cost factor of 1.0 SubmissionWhen you are finished, you just need to submit the Descriptions.java file. Note that there are a few more questions that are asked for this lab submission. As the DescriptionGenerator.java file was not modified, it does not need to be submitted. If you are done early....If you finish this lab early, use any remaining time to work on HW J7. |