ArrayLists & Methods Wrap Up Project
There are many suggested options for this Project.
Options for students on pace for 90-100%
Option 1: Hangman in JAVA
Option 2: Dice Game in Java
Option 3: MasterMind in Java
Options for students on pace for 80% or less
Option 4: Nickname Generator - easy but only if you can figure out the Substring function
Option 5: Tip Calculator - starts the easiest of all
Students who choose option 4 or 5 will not be eligible for 100% in the credit.
You have 2-3 hours to complete this project. Choose the appropriate option for your skill level.
Marking
Regardless of your project choice, for 80%+ your project must contain:
Option 1: Hangman
Difficulty: Medium to Hard
In the classic game of Hangman, one player determines the secret word and another player tries to guess the secret word one letter at a time. The base version of the assignment is only for 1 player and the words to guess will be hard coded in. This version will get you 60-70%. For a higher mark, you must implement the additional functionality listed further down in this document.
Save your game as WrapUp_hangman.java in your Data Structures Assignment project.
How it works from the User’s Perspective
Example Printout
A Loss Correct Letters so far: _AT_ _MA_ ------------- | O / | \ / \ I am sorry, you lose. | A Win Correct Letters so far: CATWOMAN ------------- | O / | \
You win! |
One Player Version (80%)
You MUST start with a 1 player version that has a hardcoded solution in an ArrayList. Make sure the chosen word has repeating characters. The suggested word for testing is CATWOMAN. Change this word later and ensure it works.
ArrayList<String> solution = new ArrayList();
solution.add(“C”); solution.add(“A”); solution.add(“T”); solution.add(“W”);
In the starter One Player version:
VERY USEFUL SUGGESTION:
Modularize your program into small tasks. Get each of those small tasks working before trying to work them into a full main method. Ideas include:
public static boolean wrongGuess(solution ArrayList, guessed character){ } - this method returns true if the guessed letter is not in the solution
public static void drawHangman(int numerrors){ } - this method uses if statements to draw the hangman using regular ascii characters
Two Player Version (20%)
Add menu to your program as follows:
10/20 - a Limited 2 Player version - Here a user is asked to enter the words to be guessed but the word must have a set number of letters. Player 1, please enter a 7 letter word.
20/20 - a Full 2 Player version - Here a user is asked to enter the words to be guessed. Any length of word is properly handled).
Al Additional Challenge (not for marks)
This update will take a significant amount of time and you will get the full 100% even if you do not fully accomplish the challenge. Just try your best.
Play around with an A.I. that attempts to solve the word you enter. On the T: drive is a txt file of most English words to help you or ask Mr. Couprie for a link.
S:/ComputerScience/DataExamples/english_words.txt
Save as Assign8_hangman_V2 so as not to wreck your original.
Option 2 Dice Game
Difficulty: Very Hard (the hardest to get full marks)
Option 3: Mastermind in Java
Difficulty: Hard (last 10% is tricky)
Option 4: NickName Generator
Difficulty: Easy, except it uses the one hard SUBSTRING function
As a Base Level Assignment: Successful Completion of this assignment will likely demonstrate 60-70% level skills.
This project is recommended for students who have struggled somewhat with the Data Structures Unit so far. It is possible to get a passing grade on this assignment using the relatively simple Base Version and then try to get a better grade by working on the harder version.
Your goal is to create a program that allows a user to enter their first and last names. You are then to generate and print back a nickname based on the first letter of their last name. It should allow the user to enter as many names as you wish and generate a nickname.
Save your game as WrapUp_NickName.java in your Data Structures Assignment project.
The nickname generated will start with the word “the” and then continue with a word or phrase that starts with the same letter as the last name.
Example run:
Please enter your first name or type exit:
Joseph
Please enter your last name:
Smith
Your funked up nickname is: Joseph “The Seagull” Smith.
Please enter your first name or type exit.
Nickname Base Version – Worth 80%
Nickname Advanced Version - Worth 20%
int roll = (int)(Math.random() * 6) // the (int) part rounds down
Option 5: Tip Calculator
Difficulty: Start the Easiest but gets harder as you aim for higher marks
Save a new file as WrapUp_TipCalculator.java into your Data Structures project.
If you complete all the requirements early and want to take it to the next level, try to add more functionality such as using another ArrayList to track multiple tables for a waiter. Save as Version2 before making this change.
This project is recommended for students who have struggled somewhat with the Data Structures Unit so far. It is possible to get a passing grade on this assignment using the relatively simple Base Version and then try to get a better grade by working on the harder version.
Tip Calculator Base Version 70%
Set up 2 parallel ArrayLists, one for the names of the people at your table and one to hold the bill totals of each their meals. Hard code 6 people and totals into the ArrayLists. (Assume a bill total includes the price of a meal, drink, etc. but no taxes or tip.)
The ‘Final 10%’ version leaves these as empty ArrayLists at first. Then as part of the run of the program, you will ask and scan in the user’s guest names and their food prices.
Ask the user for the user for a tip percentage that EVERYONE in the group will apply to their own meals. In other words, if the user enter 15, everyone will pay a 15% tip.
Print back each person’s name and then the amount they must pay. This amount must include:
Using a search of the prices ArrayList, print the name of the person who spent the most money. It should print something like: Today’s Big Spender is: Dave
Next 10%
Instead of hard coding in the people and the prices, you need to ask the user for them. To do this:
Tip Calculator Advanced Version - Worth 20%
Add an ArrayList that stores a list of menu items and an ArrayList that stores a list of their prices.
Print the menu off near the beginning of the program
For EACH of your six guests:
Continue on the program as before.