CSC110 Assignment #2: Static Methods, Scanners, for-loops solved

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

How to hand in your work
Submit the requested file (FoxSays.java) through the Assignment #2 link on the CSC 110 connex site.
Learning outcomes
When you have completed this assignment, you should understand:  How to evaluate expressions.  How to use a for-loop to repeat operations.  How to write and call a static method.  How to design, compile, run and check a simple and complete Java program on your own.  How to input data from the console.  How to use String methods.  How to indent and document a Java program.

Page 2 of 3
Create a Java program named FoxSays.java. The program will request user input from the command line, and the program then “says” the text that is entered (in a quote box created with asterisks). The program will then print an ASCII fox. Below are two examples of the output from running FoxSays with the text the user enters underlined in red:
(Original ASCII fox art credit goes to Todd Vargo)
Page 3 of 3
In your program, you will create two static methods:
1. A static method called theMessage(), which does the following: a. Prompts the user to enter text (Print out: “What does the fox say?”). b. Creates and uses a Scanner object and its nextLine() method to read input from the user through the command-line interface. c. Uses the String’s length() method to determine the message’s size (the total number of characters in the String the fox says) d. Uses for-loops to create the appropriate sized quotation box around the fox’s message (the *’s above and below the message).
2. A static method named printFox(), which should print out an ASCII fox: a. Remember your escape sequences to print out quotes (“) and backslashes (\).
Advice: Build this method in parts, compiling and running after each major addition to your code to check that the code does work as you expect. For example, you might first prompt the user to enter some text, then store the text as a string, and then directly print the text back. After that you might write theMessage() method and then, finally, add the necessary for loops.
File to submit: FoxSays.java
Marking
Your mark will be based on the following criteria:
 Your code must compile and run. It must prompt the user, read text input, and produce the expected output as described and shown above.
 Your code must conform to the requirements mentioned above (i.e., have theMessage() and printFox() methods, a Scanner object, for-loops, etc.).
 Your code must follow the guidelines outlined in Style_Guidelines.pdf, found through the Lectures & Stuff link in the Lab Resources folder on connex