Define an accessor getyears which returns the number of


Coursework 4: West Herts Education Network

Description

West Herts Education Network is an organisation which provides opportunities for teachers and education workers to meet to discuss professional issues. Local branches provide allow organisers to run seminars which members can attend. A seminar has an entry fee to cover administration. To encourage participation, members get credits for attending seminars which can then be used to get discounts at further events. This coursework is concerned with maintaining information about members and seminars, but not with how credits are later used for discounts.

Each seminar has a unique code, an organiser and a maximum number of members who can attend. Seminars also have a date and credit points which members will get for attending the seminar (expressed as a number out of 10). There is a standard entry fee of £3 for all seminars, but some seminars with external speakers may have an additional charge making the entry fee greater than £3. The seminar must also store information about members who have attended and the total fees taken for the seminar. If a member withdraws from a seminar, the credit points are subtracted from the member's total credits, but their entry fee is not refunded.

Example: CMT2 "Classroom Management" , Max : 10, Credits: 4, Fee : £5.50, Date: 12/12/2011

Member information consists of the member's unique ID number, name, credits. A new member who starts off with zero credits and increases their credits as they attend seminars. The member's grade depends on the number of years they have been teaching : "Beginner" for those who have been teaching for less than 3 years, "Ordinary" for those between 3 and 10 years (inclusive) and "Experienced" for those over 10. Beginners member can attend any seminar for an entry fee of £1, while experienced members pay only half of the entry fee. Ordinary members pay the full fee. Member's id number is allocated by the Branch secretary, and it is not the responsibility of the system to ensure that id numbers are unique.

Assignment

A partly completed project Cwk 4-students is available for downloading from Studynet Assignments. You are required to amend this BlueJ project to implement a version of the WHEN system by completing tasks below.

These tasks are to be done under supervised conditions. You may consult written sources, but are reminded that this will reduce the time you have available for completing tasks. You may NOT consult fellow students or any external human sources. Staff are available to provide only very limited help.

Each task asks increasingly difficult questions. If you cannot do the latter part of a task, move on to the next one. Code which does not compile can be commented out so that the class compiles. You can get important information by studying the code provided.

Task 1 - Amend the Member class 25 marks

1.1 Define an accessor getYears(), which returns the number of years in teaching

1.2 Declare a field to store the member's id number. Amend the constructor so that it has an additional parameter of an appropriate type which it then uses to initialise the id number field.

1.3 Define an accessor getIdNumber(),to return the member's id number.

1.4 Define a mutator addCredits() to increment the member's credits by an amount provided by a parameter value.

1.5 Define isOrdinary() to return true if the number of years of membership means that the member qualifies as an "Ordinary" member, false otherwise. (see specification above)

1.6 Define an accessor getGrade() which returns the member's grade as a String, depending on their years in teaching. (see specification above)

1.7 Amend the method toString() to include the member's id, name, their credits, teaching years and grade in the String which it returns

1.8 Define the method showYears()which will write as many stars in the terminal window as a member's years in teaching e.g. if a member has 5 years in teaching, the method writes 5 stars

Task 2 - Complete the Seminar class 15 marks

2.1 Some fields have been provided. You need to provide fields to store: the seminar title, the number of places available. (See specification above for more information on these fields)

2.2 Define accessors getFee(),getTitle(),getDate() for the seminar fee, title and date.

2.3 Define a constructor with the following parameters: a code, title (each of which should be a String), number of places and credits (each should be int), and additional fee (should be a double). The additional fee should be added to the basic fee of £3 to provide the real fee for the seminar. The date should be initialised to a default 1/1/2012.

Task 3 - Add member information to the Seminar class 20 marks

3.1 Each seminar must also store a collection of members who have attended the seminar. A field called attenders which can be used to store the collection of members in an ArrayList has been declared. Ensure that attenders is created.

Define methods:

3.2 attend() which allows the member specified as a parameter to attend the seminar by adding them to the attenders. The seminar's credits should be added to the member's credits and the fee paid by the member added to the seminar's total fees. Beginner members pay £1, experienced members pay half of the fee, ordinary members pay the full fee.

3.3 isFull() which returns true if the seminar is full, and false otherwise.

3.4 toString() which returns a String representation of all the details of the seminar including those attending the seminar.

Task 4 - Amend the Branch class 15 marks

The Branch class stores the branch's name and also has two fields: allSeminars and allMembers. allSeminars stores the collection of seminars and allMembers stores the collection of members.

4.1 Declare the allMembers field and ensure that all fields are initialised

Define methods:

4.2 addMember() which adds a Member object to the collection of all members at the branch

4.3 printAllMembers() which outputs to the terminal window details of all members at the branch

4.4 joinSeminar() which allows a Member to attend a Seminar (both the Member and the Seminar should be parameters) and outputs a suitable message to terminal window .

4.5 printAllBranchInfo() which prints to the terminal window all Branch information including its name, members and seminars

Task 5 - Amend Tester class 15 marks

The purpose of the Tester class is to test the methods in the Branch class. You may be able to write the code for these tasks even if your methods do not work properly.

5.1 Declare and create the following Member objects:

object

Id

Name

Teaching Years

m1

123

Amy

2

m2

234

Ben

3

m3

345

Chen

15

m4

456

Den

8

In the doTest() method, by making appropriate method calls on relevant objects:

5.2 Add all members m1, m2, m3 to the "Barnet" branch already declared in the Tester class

5.3 Allow the following members to attend the following seminars :

Member

Seminar

m1

s1

m2

s1

m1

s2

m2

s2

m3

s2

5.4 Withdraw m2 from s2

5.5 Output to the terminal window all the information about this branch including all its members and seminars

Task 6 - Improving the Branch class 10 marks

6.1 In the Branch class, make amendments to make your system robust, and to maintain the integrity of the data stored. It should NOT be possible :

• for a member to attend a seminar, if that member is already attending

• for a member to attend a seminar, if that member is not a member of the branch

• for a member to attend a seminar, if the seminar is full

If any of these tests fails, a suitable message is output to the terminal window, but no further action is taken.

6.2 Provide printNewMembers() which prints the details of all the "beginner" members of the Branch

6.3 Provide printPoorAttenders() which takes one int parameter giving a number of credits and outputs to the terminal window details of all members with fewer credits than this parameter value

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Define an accessor getyears which returns the number of
Reference No:- TGS01557774

Expected delivery within 24 Hours