Horse Barn Java
A horse barn consists of n numbered spaces. each space can hold at most one horse. the spaces are indexed starting from 0; the index of the last space is n - 1. no two horses in the barn have the same name. the declaration of the horsebarn class is shown below. part a. write the horsebarn method findhorsespace.. A horse barn consists of n numbered spaces. each space can hold at most one horse. the spaces are indexed starting from 0; the index of the last space is n - 1. no two horses in the barn have the same name. the declaration of the horsebarn class is shown below. part a. write the horsebarn method findhorsespace.. Horsebarn.java public class horsebarn { /** the spaces in the barn. each array element holds a reference to the horse * that is currently occupying the space. a null value indicates an empty space. */ private horse[] spaces; /** returns the index of the space that contains the horse with the specified name..
Index of the space containing the horse, if the horse is in the barn. if the specified horse is not in the barn, the return statement after the loop correctly returns -1. part (a) earned 3 points. in part (b) the student creates a new array that is the same size as the array spaces and holds references to instances of horse objects.. Barn & premise dog & cat flea control supplements blood builders calming digestive electrolytes feed through fly control feed through wormers hoof care horse cough & allergies joint supplements life stages multi purpose pain relief performance & energy. Answer to horsebarn free response problem from the 2012 ap computer science exam.