Question: You will create your own silly story based on information provided by the user. For example, the parts in bold were entered by the user.
You will create your own silly story based on information provided by the user. For example, the parts in bold were entered by the user. For ideas see: Mad Libs.
My Silly Story name: Frank Zhang whole number: 345 body part: stomach noun: cup floating point number: 1.23 clothing article: hat destination: Colorado goal: degree
The resulting story is:
Congratulations! Today is your 345 day. You're off to Colorado! You're off and away! You have brains in your stomach, You have feet in your hat. You can steer yourself any direction you choose. You're on your own with $1.23. And you know what you know. And YOU are the cup who'll decide where to go. be your name Frank Zhang or Bixby or Bray or Mordecai Ali Van Allen O'Shea, You're off to Colorado! Today is your day! Your degree is waiting. So...get on your way! Based on Dr. Seuss "Oh, the Places You'll Go!" and adapted by Jim Williams
Requirements:
Your main method should contain all input code (e.g., Scanner instance) and have 8 user prompts inputting values with nextInt(), nextDouble(), next() and nextLine().
All output code (e.g., print statements) must be in the main method as well.
The prepareStory method takes the arguments passed in and prepares the entire story, using all the 8 parameters and returning one long String.
The names of the parameters for the method should be changed to better reflect their contents.
You do not need to use the above story. Get creative and come up with your own Mad Lib!
Your story must contain your name as you entered it in the file header comments. It should be a string literal and not a parameter.
The method stub for prepareStory is:
/** * Returns a String that is a story containing the 8 arguments passed in. Also, your story must include * the author's name (your name) within it using a string literal (don't pass as a parameter).Your name must match the name * within the File Header Comment. * * There are no input or output statements within this method. All input and * output is done in the main method and the user must be prompted for all the arguments. * * Note: Your method must have the name 'prepareStory', must have 8 parameters with the same data types shown and * in the same order. You must change the parameter names to match values in your story. For example, you may want * to prompt for a verb, and store in a String parameter you name verb, or an adjective and store in a String param you * name adjective. * * @param num1 Interger 1 * @param str1 String 1 * @param str2 String 2 * @param str3 String 3 * @param str4 String 4 * @param dbl1 Double 1 * @param str5 String 5 * @param str6 String 6 * @return A story containing the 8 arguments and includes the program author's name. */ public static String prepareStory(int num1, String str1, String str2, String str3, String str4, double dbl1, String str5, String str6) { //FILL IN BODY }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
