|
CSE 1030 - Assignment #3 - Adding static Statistics to the Musician Class
SC/CSE 1030 - Fall 2012 - Assignment #3
Adding static Statistics to the Musician Class
The Kapellmeister
of the York University Symphony Orchestra is very happy with the
work you did last week! Because of your diligence,
she now has a class in which she can store the information for the symphony musicians.
But now she has another problem - her symphony is huge, and she is finding it difficult
to remember how many musicians are in each section of the symphony. Can you help her?
Your goal for this assignment is to expand the Musician Java Class
from last week by adding two static functions:
public static int getNumberOfMusicians(), and,
public static int getNumberInSection(SymphonySection section)
The extended API for the Musician class (including the two new functions) is documented here:
The Musician Class.
To complete this assignment, you must do these things:
Extend the Musician class, matching the details given in
the Musician API.
You are responsible for defining and managing the data
members of the Musician class that you will need to hold the
counts of how many musicians are in each symphony section,
and for implementing the two new functions
getNumberOfMusicians(), and,
getNumberInSection(SymphonySection section).
You should review the rest of the Musician class and
make any other changes necessary to keep the symphony
section counts accurate.
Include appropriate comments and Javadoc comments in your source code.
Submit your Musician class electronically before the deadline
using the submit command:
submit 1030 a3 Musician.java
Some notes:
Since your task is to expand the Musician class from last week,
you may use either your solution to Assignment #2, or the
prof's solution:
Musician.java,
as the base for this week's assignment.
You will find the following class useful:
SymphonySection.java
We have also provided the
API for the SymphonySection class.
(Note, you should not change the SymphonySection class to complete this assignment.)
A Java program that provides a simple command-line interface
for testing your Musician implementation, is available here:
a3.java.
Compile (javac a3.java Musician.java SymphonySection.java)
run (java a3)
and use this program to test your code.
(Also note that you can compile with less typing by entering
javac *.java)
Your source code should be well organised and documented.
Remember the Course's, Department's, and the University's
policies on academic honesty - do your own assignment yourself.
(Besides, doing it yourself is the only way to learn!)
This assignment is due on Friday September 28, at noon. Late
assignments will not be accepted.
Start Early - Don't leave your assignment to the last minute!
Remember that you can use the submit command more
than once - if you submit your Musician.java file again, it will
replace the previous submission.
So if you
make a mistake, don't panic, just fix it, and resubmit it
(before the deadline).
Additional information regarding the submit command can be
found by typing man submit at the command line.
Do not use the Type package, nor its earlier
incarnation, the york package.
Your programs must compile and run on the Prism computers.
Your grade will be a number from 0 to 10. The breakdown is
1 mark for properly implementing some private data members within the Musician
class for storing the symphony section counts.
1 mark for implementing the getNumberOfMusicians() function.
1 mark for implementing the getNumberInSection() function.
2 marks for defining the necessary private static helper functions
so that your implementation does not contain too much code redundancy.
3 marks for keeping your symphony section counts accurate even when the
setSection() function, and either of the two constructors are used.
2 marks for coding style (nicely organised code with comments).
Have FUN!
|
|