Question
Given the following Playable interface, Note class, and Chord class: /** * The requirements of a Playable in a song */ public interface Playable {
Given the following Playable interface, Note class, and Chord class:
/** * The requirements of a Playable in a song */ public interface Playable
{
/** * Play this Playable */
public abstract void play();
}
/** * A single Note in a song */
public class Note implements Playable
{ // Details omitted
/** * Explicit Value Constructor
*
* @param pitch The pitch ('A','B','C','D','E','F', 'G' or 'R')
* @param sharp true for a sharp and false for a natural
* @param octave The octave (relative to middle C)
* @param duration 1 for whole notes, 2 for half notes, etc...
* @param dotted Whether the note is dotted
*/
public Note(char pitch, boolean sharp, int octave, int duration, boolean dotted)
{
// Details Omitted }
/** * Play this Note */
public void play() {
// Details omitted } }
/** * A Chord in a song */
public class Chord implements Playable {
// Details omitted
/**
* Explicit Value Constructor *
* @param notes The Note objects in the Chord
*/
public Chord(List notes) {
// Details Omitted }
/**
* Play this Note
*/
public void play() {
// Details omitted }
}
create a Lyric class that specializes the Note and adds a void setSyllable(String s) method and a String getSyllable() method.
Remember to include an appropriate constructor.
Given the Playable interface, Note class, and Chord class in the previous question, create a Lyric class that can be used to decorate (in the sense of the Decorator Pattern) either a Note object or a Chord object and adds a void setSyllable(String s) method and a String getSyllable() method. Remember to include an appropriate constructor.
I've developed an email system called JMUmble. In this system, arriving messages are handled by a PostOffice object. Depending on how the system is configured at runtime, one or more objects might need to know when a message arrives. I have currently implemented several such classes: ScreenFlasher (which makes the entire screen flash -- you always know when a message has arrived), PopularityTimer (which starts a clock that show the amount of time since the most recent message arrived), and Mumbler (which uses speech generation to read the name of the person that sent the message -- this is where the system got its name). Use the observer pattern to develop a class model of this system (in UML). You do not need to include the attributes of each class, only the operations/methods. Include comments that describe each operation/method.
Compare and contrast the "Pipe and Filter" architectural style with the "Layered" architectural style.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started