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
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"); }
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
public class Music private String instrumentName private Picture image private Sound sound publi... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
635d5698863c6_174697.pdf
180 KBs PDF File
635d5698863c6_174697.docx
120 KBs Word File
