In java create the following. create an ADT called Music that has instrument name, image (type Picture),
Fantastic news! We've Found the answer you've been seeking!
Question:
In java create the following.
create an ADT called Music that has instrument name, image (type Picture), and sound (type Sound). Create a separate testing program to test your ADT as follows:(we will be adding pictures and sounds later)
- create an array to hold 5 Music items
- fill the array by instantiating 5 objects
- Use one or more loops to access your array and:
- display the instrument names
- display the instrument images
- play the instrument sounds
- in a different program copy the linear search code and create a testing program. You need to call this method to let the user search for a specific instrument and -- when the instrument is found -- either display the name and the image or play the sound. Test this logic with an instrument that is 'not found' and also one that 'is found'.
Linear search { /** * Implement a linear search through the list **/ public static String linearFind(String target, String[] list) { for (int index=0; index < list.length; index++) { if (target.compareTo(list[index]) == 0) {return("Found it!"); } } return("Not found"); }
Related Book For
Principles of Information Systems
ISBN: 978-1133629665
11th edition
Authors: Ralph Stair, George Reynolds
Posted Date: