Due: Monday, April 23rd, 2012.
| Main topics: | Boolean expressions |
| if & if - else statements | |
| While loops | |
| User defined methods
|
You are to write a Java program that:
Requirenments:
public static String expose(String comPhrase, String expSoFar, char guess)
You must write and use a method named done that takes the values of the "common phrase" and expSoFar as input and returns true exactly when all the letters in expSoFar have been exposed.
public static boolean done(String comPhrase, String expSoFar)
Grading:
| Performance Indicator | [1] | [2] | [3] |
| Readability and documentation | 0 | 1 | 1 |
| Use of loops | 1 | 2 | 2 |
| Use of methods | 1 | 2 | 2 |
| Functional requirements | 2 | 3 | 4 |
| Efficiency | 0 | 1 | 1 |
Sample run(s):
Please enter the phrase to guess at : who do you love Common Phrase ------------- ??? ?? ??? ???? Enter a lowercase letter guess : f Common Phrase ------------- ??? ?? ??? ???? Enter a lowercase letter guess : o Common Phrase ------------- ??o ?o ?o? ?o?? Enter a lowercase letter guess : s Common Phrase ------------- ??o ?o ?o? ?o?? Enter a lowercase letter guess : w Common Phrase ------------- w?o ?o ?o? ?o?? Enter a lowercase letter guess : h Common Phrase ------------- who ?o ?o? ?o?? Enter a lowercase letter guess : d Common Phrase ------------- who do ?o? ?o?? Enter a lowercase letter guess : e Common Phrase ------------- who do ?o? ?o?e Enter a lowercase letter guess : y Common Phrase ------------- who do yo? ?o?e Enter a lowercase letter guess : u Common Phrase ------------- who do you ?o?e Enter a lowercase letter guess : l Common Phrase ------------- who do you lo?e Enter a lowercase letter guess : v Common Phrase ------------- who do you love
CEAS-Computer Science Select Intro Computer Programming