Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Goal, Description and Submission Instructions
- The goal of this project is to become more familiar with creating and using classes and objects in Java, to further
- introduce you to the concepts of abstraction and modularization, and to directly use collections of items.
- Instructions
- Create a new Java project named “Project1_netid” (where you replace netid with your NetID). Be sure to
- include the Text and ListSpinner classes posted on Blackboard, in the Course Materials section. (They
- are in the project WheelTemplate). DO NOT MODIFY THESE TWO CLASS FILES IN ANY WAY.
- 1. Create a Puzzle class in preparation for the next Project, that has the following components:
- a. A field for the Puzzle’s category (thing, place, etc.) and a field for the phrase to be guessed
- b. Create a constructor that takes a category and phrase as input. *Make sure you convert the values supplied
- to the parameters to be all uppercase letters.
- c. Write get and set methods for both fields.
- d. Write a toString method that prints out the phrase followed by category in parentheses.
- e. Create a main method to test the class by creating a Puzzle and printing it out by calling toString().
- 2. Create a RandomString class (starting from the template on Blackboard) and implement the following:
- a. Create a file named wheel_values.txt in the Project1_netid project that contains dollar amounts for the
- values in your wheel spinner. Some valid values include 600 or $3,000. This file will have one value per
- line. Make sure this file is in the topmost project folder, not inside your src folder (i.e., it should show up
- below the JRE System Library).
- b. A constructor that receives the name of a file to get string values from. The constructor should read in the
- phrases from the file and store them for later use using a private loadStringsFromFile method.
- c. next – a method that returns a random string value from the file; this value shouldn’t be repeated until
- all guess phrases in the file have been used.
- d. shuffle
- e. Create a main method to test that next is working correctly by repeatedly calling next & printing the result
- – you should not have any repeats, and the phrases should not be in the same order as in the file.
- f. Once you’ve verified your RandomString class is working by testing it in main, run the
- ListSpinner class to verify your wheel will spin properly.
- 3. Be sure to:
- a. Use proper indentation
- b. Use appropriate variable/field names
- c. Group like things together (items that are part of the same objects)
- d. Use appropriate comments – including comments for each method
- e. Check your curly braces
- 4. For this project you will submit the following (see “Saving and Submitting your Work” for details):
- a. A general archive file (e.g. a zip)
- b. A runnable JAR file
- c. At least one JPG showing your application
Advertisement
Add Comment
Please, Sign In to add comment