Question: Using the testFarm class create tests that will make sure that your Farm works as intended. The basic outline of the class is already given
Using the testFarm class create tests that will make sure that your Farm works as intended. The basic outline of the class is already given to you, make sure your output matches what is given to you.
public class Farm { /* * class properties: one for the cows, chickens, and sheep */ private int cows; private int chickens; private int sheep; /** * this constructor will create a farm object with no animals ( 0 of each animal) */ Farm(){ //your code } /** * @param cows - number of cows * @param chickens - number of chickens * @param sheep - number of sheep * * this constructor will create a farm object with the specified * number of each animals * */ Farm(int cows,int chickens, int sheep){ //your code } /** * @param cows * @param chickens * @param sheep */ void setAnimals(int cows,int chickens, int sheep){ //your code } /** * @return */ int getCows(){ //your code } /** * @return */ int getChickens(){ //your code } /** * @return */ int getSheep(){ //your code } /** * @param num */ void addCows(int num){ //your code } /** * @param num */ void addChickens(int num){ //your code } /** * @param num */ void addSheep(int num){ //your code } /** * @param num */ void removeCows(int num){ //your code } /** * @param num */ void removeChickens(int num){ //your code } /** * @param num */ void removeSheep(int num){ //your code } /** * @param farm * @return will return a boolean that states weather the farm * has the same exact number of each chickens, cows, and sheep */ boolean equals(Farm farm) { //your code } /** * will return a String in the form * "x cows, y chickens, z sheep" * where x, y, and z are the respective number of each animals * */ public String toString() { //your code } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
