Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Here's cow.java: public class Cow { //cut and paste a cow here private String body = ^__^ + (oo)_______ +

image text in transcribedimage text in transcribedHere's cow.java:

public class Cow {

//cut and paste a cow here private String body = " ^__^ " + " (oo)\\_______ " + " (__)\\ )\\/\\ " + " ||----w | " + " || || ";

protected String quoteLine = " \\ " + " \\ " + " \\";

}

Kitty.java is here:

public class Kitty extends Cow {

private String body = " (\"`-' '-/\") .___..--' ' \"`-._ " + " ` *_ * ) `-. ( ) .`-.__. `) " + " (_Y_.) ' ._ ) `._` ; `` -. .-' " + " _.. `--'_..-_/ /--' _ .' ,4 " + " ( i l ),-'' ( l i),' ( ( ! .-' ";

}

Dragon.java is here:

public class Dragon extends Cow {

private String body = " / \\ //\\ " + " |\\___/| / \\// \\\\ " + " /0 0 \\__ / // | \\ \\ " + " / / \\/_/ // | \\ \\ " + " \\_^_\\'/ \\/_ // | \\ \\ " + " //_^_/ \\/_ // | \\ \\ " + " ( //) | \\/// | \\ \\ " + " ( / /) _|_ / ) // | \\ _\\ " + " ( // /) '/,_ _ _/ ( ; -. | _ _\\.-~ .-~~~^-. " + " (( / / )) ,-{ _ `-.|.-~-. .~ `. " + " (( // / )) '/\\ / ~-. _ .-~ .-~^-. \\ " + " (( /// )) `. { } / \\ \\ " + " (( / )) .----~-.\\ \\-' .~ \\ `. \\^-. " + " ///.----..> \\ _ -~ `. ^-` ^-_ " + " ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ " + " /.-~ ";

}

Please help me with cowsay.java!

Your program must be able to handle three kinds of arguments: -l, -f, and the text intended for the cow to say, -1 must list the available cows (such as cow or kitty) alphabetically and then terminate the program (ignoring any subsequent arguments) f must interpret the user's next input to determine whether it matches an available cow. If the cow is available, the rest of the cowsay program must execute, printing out the cow and the quote. If the cow isn't available, print a "Could not find" message and terminate. If no input is given, print a "No filename given" message -l or -f must be the first arguments in order for them to execute, otherwise they will be considered part of the cow quote or an -f query. Text intended for the cow to say must include spaces. If the user gives no arguments at all, give no output and terminate the program. Your main file must be named cowsay.java. The rest of the files should be based on the provided templates. Download the template files (Cow.java, etc.) and put them in your working directory, without changing their names or types. Each separate template class extends the Cow class, so for instance, in this program, the class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students explore these related Databases questions