Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/* HeiferGenerator.java*/ public class HeiferGenerator { public static Cow[] getCows() { if ( cows == null) { cows = new Cow[ cowImages .length]; for (int
/* HeiferGenerator.java*/
public class HeiferGenerator { public static Cow[] getCows() { if (cows == null) { cows = new Cow[cowImages.length]; for (int index = 0; index cows.length; index++) { cows[index] = new Cow(cowNames[index]); cows[index].setImage(quoteLines + cowImages[index]); } } return cows; } private static String[] cowNames = { "heifer", "kitteh" }; private static String quoteLines = " \\ " + " \\ " + " \\ "; private static String[] cowImages = { " ^__^ " + " (oo)\\_______ " + " (__)\\ )\\/\\ " + " ||----w | " + " || || ", " (\"`-' '-/\") .___..--' ' \"`-._ " + " ` *_ * ) `-. ( ) .`-.__. `) " + " (_Y_.) ' ._ ) `._` ; `` -. .-' " + " _.. `--'_..-_/ /--' _ .' ,4 " + " ( i l ),-'' ( l i),' ( ( ! .-' " }; private static Cow[] cows = null; }
In java 8. Paste the code for Cowsay.java and Cow.java
Specification Students will construct two classes: a driver class with a main() entry point (Cowsay) and a data class (Cow). Note that HeiferGenerator.java is provided for you; you code must use this class to create the cow objects. All attributes /methods must be private unless noted in the specificationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started