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: A musician is an individual that plays an instrument in the orchestra. You will defifine a musician as an interface as all the musicians will share common methods.
Musicians will have an instrument that they can play softly or loudly.
- Violinists: As an example of a musician, you will need to create a class representing violinists.
- Cellists: Other musicians will also be required, for example, a cellist might go very nicely with the violinists.
- Pianists: Occasionally, we will need some pianists for certain symphonies.
- a Conductor: In order to tell the musicians what to play it will be necessary to have a conductor. Their job will be to arrange the musicians in the orchestra and to give the musicians their particular piece of music to play. They will also instruct the musicians when to play each note.
- a Sound System: This allows musicians to play music through the computer. This SoundSystem class is supplied to you and the instructions later tell you how to utilise it.
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.
- Create a package called people.
- The property for the Person class (in the people package) that you will need to defifine is:
– name – this is the name of the person.
- Defifine the property as you think appropriate, and create a constructor that initialises the property with the following signature Person(String name)
- Defifine the accessor methods
– 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.
- Create a (sub-)package called musicians inside the people package (i.e., people.musicians).
- The abstract methods of the Musician interface (inside the people.musicians package) are as follows:
– 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.
- instrumentID – the type of instrument the musician plays. This is represented by an int (the instrument’s ID). A mapping table of instruments can be found in Table 1.
- List<Integer> notes – the list of notes for the current score read by the musician.
- Iterator<Integer> nextNote – the iterator to the next note to be played.
- soundSystem – the SoundSystem to be used to play music by the musician
- seat – the seat of the musician in the orchestra (must be between 0 and 15).
- loudness – the volume for the musician to play the music score. The volumes of these for some of the instruments are included in Table 1.
The behaviour of the musicians is as follows.
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: firstname.lastname@example.org 微信号:vipnxx