L01b

Due by the end of this meeting


SUBMIT   /   Submission Summary

Review of CSCI 1226

Create a program called A01Prep. its main method should be as follows:

// activity 1 double size = getServingSize(); System.out.println("You said the serving size was " + size + " grams."); // activity 2 String[] words = {"One", "Two", "Three", "Four", "Five", "Six", "Seven"}; printLongWords(words);
Activity 1
Write the getServingSize method. Make it behave as the javadoc comment in A01 says:
/** * Read a valid serving size from the user. The serving size must be * positive. The method continues to prompt until a positive number has been * entered. * * @return the serving size entered by the user */
Activity 2
Write the printLongWords method. This method asks the user for the shortest word they'd like to see, and then the method goes thru the array it was given, printing the words that are that length or more. For example,
How many letters in the shortest words to show: 4 Here are the words of 4 or more letters: Three Four Five Seven

If the number the user enters is negative, the program instead prints out an error message.

How many letters in the shortest words to show: -1 That doesn't make any sense!
Submit your program by the end of this recitation.

Your grade will be based on the following rubric:

Submit this/these files:


SUBMIT   /   Submission Summary