Question: Design and implement a fully functional Java program named Quotations which display quotes and their authors. Your program must contain a main method and two
Design and implement a fully functional Java program named "Quotations" which display quotes and their authors. Your program must contain a main method and two additional methods named displayQuote declared as follows:
public static void displayQuote(String quote, String author)
public static void displayQuote(String quote)
The first method accepts a String parameter named quote, followed by a second String parameter named author.
The second method overloads the first method and accepts only a String parameter named quote. This method will always use the String "Anonymous" as the authors name.
Your main method must call both of these methods. It should call the first method with the arguments
I would like to die on Mars. Just not on impact., Elon Musk
It should then call the second (overloaded) method with the argument
All easy problems have already been solved.
Note that no author is provided for the second quote; the overloaded method must provide the author's name as "Anonymous".
Your methods must display the following expected output, formatted exactly as shown.
Expected Output:
I would like to die on Mars. Just not on impact. -Elon Musk
All easy problems have already been solved. -Anonymous
The quotes must be enclosed in quotation marks; the author names must be displayed on the following line with the name preceded by a dash (-) character. Display a blank line after the authors name.
No output operations are allowed in the main method! All output must be displayed by your two displayQuote methods.
Your program must conform to the course programming assignment rubric. This includes the following:
ID header must be provided
Indentation and alignment must be consistent and correct using course conventions
Use named constants for the String literals representing quotes and authors
Descriptive comments must be provided
Program must compile and run with no errors
Methods must be correctly designed and implemented
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
