[ Course Schedule ]
[ Syllabus ]
ITEC 120
L10b: Arrays of Objects
Objectives
To successfully complete this lab you will develop methods that operate on arrays of objects.
Assignment
For this assignment you will implement some familiar methods that operate on arrays of treasures.
TreasureArraySrv
Create a service class named ArraySrv and implement the methods described below. Start by creating stub methods and use the incremental, test-driven development process. Use the appropriate type of loop to implement each method.
- min – takes an array of treasures and returns the treasure with the lowest value.
- max – takes an array of treasures and returns the treasure with the highest value.
- isFound – takes an array of treasures and a single treasure. Uses the equals method to answer if the given treasure is found in the array.
- timesFound – takes an array of treasures and a single treasure. Uses the equals method to return the number of times the given treasure is found in the array.
- searchVal – takes an array of treasures in ascending order of value and a single treasure. Uses the compareTo method to answer if a treasure that has the same value as the given treasure is found in the array.
TreasureArrayDrv
Create a test driver with test cases to test these methods you wrote. You may want to refer to the test cases for lab 8a to see similar test cases. You will need an empty array of treasure and a few other arrays of treasures. You may want to create these arrays at the top of the test driver and use them throughout the test driver.
Submit Your Assignment
Submit TreasureArraySrv.java and TreasureArrayDrv.java to the L10b dropbox on D2L.
[ Course Schedule ]
[ Syllabus ]