Question: file for cach class and write one or more test methods to ensure the classes and methods meet the specifications. .Bunny, PetBunny, HouseBunny, JumpingBunny, and





file for cach class and write one or more test methods to ensure the classes and methods meet the specifications. .Bunny, PetBunny, HouseBunny, JumpingBunny, and ShowBunny Requirements and Design: No changes from the specifications in Bunnies Part I BunnyList.java Requirements: The BunnyList class provides methods for reading in data and generating reports summary and list, adding a bunny, and sorting the bunnies by name and by estimated monthly cos) Design: The BunnyList class has fields, a constructor, and mcthods as outlined below. (1) Fields: All fields below should be private and initialized in the constructon (a) listVame is type String (b) bunryList is type Bunny array (c) exciudedRecords is type String array Note that the bunny array and excluded records array should grow as items are added. Hence, the length of these arrays should be the same as the mumber of objects in the arrays. This eliminates the need for separate variables to track the number of objects contained in the arrays, and it also allows the use of for-cach loops with the arrays. (2) Constructor: The constructor has no parameters and initializes the fields as follows: listName is initialized to "not yet assigned", bunnyL.ist is inied to a Bunny array with length zero, and excludedRecords is initialized to a String array with length zcro. (3) Methods: Usually a class provides methods to access and modify cach of its instance variables (i.e., gelters and setlers) long with any other required methods. The methods for BunnyList are described belovw readBunnyFile has no return value, accepts the data file name as a String, and has a throws clause for FileNotFoundException. This method creates a Scanner object to read in the file and then reads it in line by line. The first line of the file contains the name of the list, and each of the remaining lines contains the data for a bunny. After reading in the list name, the "bunny" lines should be processed as follows A bunny line for record is read in, a second Scanner is created on the line, and the individual values for the bunny are read in. Non-String values should he "parsed" into their respective values using the appropriate wrapper class (c.g., Double.parseDouble() After the values on the line have been read in, an "appropriate" bunny object is created and added to the bunny array using the addBunny method. If the bunny type is not recognized, the record line should be added to the excluded records array using the "conama separated values" file, i.?., if a line contains multiple values, the values are delimited by commas. So after you set up the Scanner for the bumny lines, you need to change the delimiter to "by invoking useDe11miter(",") on the Scanner object Each bunny line in the file begins with a category for the bunny. Your switch statement o All values should be read as strings method. The data file is a Page 2 of6 file for cach class and write one or more test methods to ensure the classes and methods meet the specifications. .Bunny, PetBunny, HouseBunny, JumpingBunny, and ShowBunny Requirements and Design: No changes from the specifications in Bunnies Part I BunnyList.java Requirements: The BunnyList class provides methods for reading in data and generating reports summary and list, adding a bunny, and sorting the bunnies by name and by estimated monthly cos) Design: The BunnyList class has fields, a constructor, and mcthods as outlined below. (1) Fields: All fields below should be private and initialized in the constructon (a) listVame is type String (b) bunryList is type Bunny array (c) exciudedRecords is type String array Note that the bunny array and excluded records array should grow as items are added. Hence, the length of these arrays should be the same as the mumber of objects in the arrays. This eliminates the need for separate variables to track the number of objects contained in the arrays, and it also allows the use of for-cach loops with the arrays. (2) Constructor: The constructor has no parameters and initializes the fields as follows: listName is initialized to "not yet assigned", bunnyL.ist is inied to a Bunny array with length zero, and excludedRecords is initialized to a String array with length zcro. (3) Methods: Usually a class provides methods to access and modify cach of its instance variables (i.e., gelters and setlers) long with any other required methods. The methods for BunnyList are described belovw readBunnyFile has no return value, accepts the data file name as a String, and has a throws clause for FileNotFoundException. This method creates a Scanner object to read in the file and then reads it in line by line. The first line of the file contains the name of the list, and each of the remaining lines contains the data for a bunny. After reading in the list name, the "bunny" lines should be processed as follows A bunny line for record is read in, a second Scanner is created on the line, and the individual values for the bunny are read in. Non-String values should he "parsed" into their respective values using the appropriate wrapper class (c.g., Double.parseDouble() After the values on the line have been read in, an "appropriate" bunny object is created and added to the bunny array using the addBunny method. If the bunny type is not recognized, the record line should be added to the excluded records array using the "conama separated values" file, i.?., if a line contains multiple values, the values are delimited by commas. So after you set up the Scanner for the bumny lines, you need to change the delimiter to "by invoking useDe11miter(",") on the Scanner object Each bunny line in the file begins with a category for the bunny. Your switch statement o All values should be read as strings method. The data file is a Page 2 of6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
