Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question B1 A musician is producing a catalogue of sheet music (printed music) she has collected over a number of years. She is writing a

image text in transcribedimage text in transcribedimage text in transcribed

Question B1 A musician is producing a catalogue of sheet music (printed music) she has collected over a number of years. She is writing a java application to help her keep track of the origins and reference numbers she has allocated to each piece of music. The following is an incomplete class definition to represent a piece of sheet music. public class SheetMusic \{ private String title; private String author; private String reference; public SheetMusic (String title, String author, \{ String reference) this.title = title; this.author = author; this.reference = reference; / ** * search title for some words, return true * or false */ public boolean titlematch (String text) \{ \} // bo bempleted \} The class SheetMusic records details for a piece of music in the catalogue. The method titleMatch is incomplete. a) Write appropriate accessor methods for the title, author and reference fields. [3 marks] b) Complete the body of the titleMatch method. The method should return true if the title of the music contains the text parameter, and false otherwise. [4 marks] A separate class, Catalogue, will maintain a list of SheetMusic objects together with the name of the person owning the catalogue. The class has been partially written, as follows: c) Write a constructor for the Catalogue class. The constructor should have a name initialised using a parameter to the constructor, and the tunes field initialised to an empty list. [4 marks] d) Write a method, addTune, to add a SheetMus ic object to the list of tunes. [4 marks] e) The tunesMatching method will search all tunes in the list for a title containing the given text, and return an Arraylist of tunes which contain the text in their title. Complete the body of the tunesMatching method. [10 marks]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

More Books

Students also viewed these Databases questions