Java代写｜COMP1202 Programming I (2022-23) Coursework: ECS Band Aid (Version 2.2)
The aim of this coursework is to construct a virtual representation of an orchestra. This orchestra will consist of a number of musicians that each play part of a larger musical piece under the direction of a conductor. Based on this concept of orchestra, we will create a simple simulation of (super-)band called “ECS Band Aid”.
You are not required to have any musical knowledge in order to complete this coursework.
The ECS orchestra may bear some similarities to a real orchestra but is very simplifified and in some cases likely to be quite difffferent to how a real orchestra might work. Your task is to implement the specifification as written. No marks will be awarded for deviating from the specifification in order to increase the realism of the orchestra in fact it may well cost you marks.
n some cases, specifific names are defifined or specifific properties given for classes. This is mainly to ensure that we can easily read your code, and fifind the parts that are most relevant to the marking scheme. You will not gain marks for deviating from the specifification in order to increase the realism of the simulation. In fact, it may cost you marks and make it harder to assess what you have written. In some cases, we wish to know that you can use specific Java constructs, so if it specififies an ArrayList then we want to see you use an ArrayList.
There might be other ways of implementing the same feature but we are trying to assess your ability to use specifific constructs. Where the specifification is less explicit in the way something is implemented (for example, by omitted what data types to use) you are free to make your own choices but will be assessed on how sensible those choices are. Comments in your code should explain the choices you have made.
How the ECS Orchestra Works
For this coursework, you are expected to follow the specifification of the orchestra as set out below. This may not correspond exactly to an orchestra in reality but we have chosen particular aspects for you to model that help you to demonstrate your Java Programming.
There are a number of people and objects that contribute to an orchestra. For our purposes these include:
Musicians will have an instrument that they can play softly or loudly.
The class is available at https://tinyurl.com/SoundSystem2223. This class must be placed in a package named utils. More information about the SoundSystem.java can be found in the Javadoc in the same repository.
The next sections will take you through the construction of the various people in your orchestra. You are recommended to follow this sequence of development as it will allow you to slowly add more functionality and complexity to your orchestra.
Part 1 – Modelling the Violinists
The Person Class
Before modelling the various types of musicians, we fifirst model the Person class, which will be the basis for musicians and conductors.
– name – this is the name of the person.
– getName() – to return the name of the person.
The Musician Interface
The Musician interface is common for all types of musicians. Follow the steps below to create this interface.
– void setSeat(int seat): to tell the musician what seat they are sitting in. The input seat is assumed to be between 0 and 15.
– void readScore(int notes, boolean soft): to read the music score represented by an array of music notes (parameter notes), including whether or not the musician will softly or loudly (parameter soft).
– void playNextNote(): after setting the position of the musician (using setSeat) and the musician reads the score (using readScore), playNextNote will play the next note (and only the next node) in the music score. This method will do nothing if there are no more notes to play.
The Violinist, Cellist, and Pianist Classes
To model the various types of musicians you will need for your orchestra you will need to use inheritance. The diagram in Figure 1 shows you how the minimum hierarchy of the musician classes (i.e., Violinist, Cellist, and Pianist) relate to the Person class and the Musician interface. All musicians (e.g., Violinists, Cellists, or Pianists) extend the Person class and implements the Musician interface. (Hint: You can introduce additional classes/interfaces to the hierarchy to help with the implementation). Every musician class, e.g., Violinist,Cellist, or Pianist, should have the following properties.
The behaviour of the musicians is as follows.