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.. Play set horse ranch with barn is rated 4.6 out of 5 by 8. rated 5 out of 5 by quarter horse from ranch farm set kids love playing with this "ranch" nice set, great for inside or outside play with real grass and their pretend animals that "talk". 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..
Answer to horsebarn free response problem from the 2012 ap computer science exam. 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.. 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..