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

1 Expert Approved Answer
Step: 1 Unlock

public class Music private String instrumentName private Picture image private Sound sound publi... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

635d5698863c6_174697.pdf

180 KBs PDF File

Word file Icon

635d5698863c6_174697.docx

120 KBs Word File

Students Have Also Explored These Related Business Communication Questions!