60 316
Assignments Done
98%
Successfully Done
In April 2018

Answer to Question #58977 in Java | JSP | JSF for Peter

Question #58977
Question: Create a class that will output some famous quotes.

FamousQuotes

+ FamousQuotes()
+ quoteAristotle():void
+ quoteShakespeare ():void
+ quoteGeneKranz():void
+ quoteOscarWilde():void

The quotes that should be output for each method are:
Aristotle: Happiness depends upon ourselves
Shakespeare: 'Tis the mind that makes the body rich
Gene Kranz, (Nasa): Failure is not an option
Oscar Wilde: Experience is the name we give to our mistakes

• Create an application program that will instantiate/create an object of FamousQuotes and test all four of its methods.

• Update the program to include the following quote:
“If the facts don't fit the theory, change the facts”, Albert Einstein
Expert's answer

public class FamousQuotesTest {

public static void main(String[] args) {

FamousQuotes famousQuotes = new FamousQuotes();

famousQuotes.quoteAristotle();
famousQuotes.quoteShakespeare();
famousQuotes.quoteGeneKranz();
famousQuotes.quoteOscarWilde();
famousQuotes.quoteAlbertEinstein();

}

}






public class FamousQuotes {

FamousQuotes() {}

public void quoteAristotle() {
System.out.println("Happiness depends upon ourselves");
}

public void quoteShakespeare() {
System.out.println("'Tis the mind that makes the body rich");
}

public void quoteGeneKranz() {
System.out.println("Failure is not an option");
}

public void quoteOscarWilde() {
System.out.println("Experience is the name we give to our mistakes");
}

public void quoteAlbertEinstein() {
System.out.println("If the facts don't fit the theory, change the facts");
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions