Amend the constructor so that it has an additional parameter

Assignment Help Programming Languages
Reference no: EM131175512

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

Reference no: EM131175512

Questions Cloud

What is the total amount to be credited to accrued payroll : What is the total amount to be credited to Accrued Payroll in respect of July earnings?- what would be the balance in Accrued Payroll account at the close of business on July 31?
How much would you be willing to pay to play this game : You toss independently a fair coin and you count the number of tosses until the first tail appears. If this number is n, you receive 2n dollars. What is the expected amount that you will receive? How much would you be willing to pay to play this g..
Discuss that employees feel their jobs are interesting : Draw on conclusion as to whether you agree or disagree. You will find helpful advice on how to answer an essay which requires you to 'discuss' in the Essay Preparation and Writing Guide, which is on this Moodle site.
Analyze the ethical principles which may affect your study : Analyze the ethical principles which may affect your study. What are the specific ethical concerns associated with your research question or approach?
Amend the constructor so that it has an additional parameter : Define an accessor getYears(), which returns the number of years in teaching. 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..
Solve the problem using inclusion-exclusion form : What is the probability that at least one of his friends will get the correct card? Hint: Use the inclusion-exclusion formula.
Describe your sample using descriptive statistics : Develop a problem statement that incorporates the scholarly literature to support your rationale. Develop a research question based on the problem statement. Formulate a null and an alternative hypothesis set based on the research question.
What is the joint pmf of x and y : Consider four independent rolls of a 6-sided die. Let X be the number of 1s and let Y be the number of 2s obtained. What is the joint PMF of X and Y?
Describe the differences between hard and soft skills : Analyze the possible reasons for the recent findings that fewer college graduates are employment ready. In other words, explain why they are lacking in hard and soft skills. Back up your ideas and opinions with information cited from this module's..

Reviews

Write a Review

Programming Languages Questions & Answers

  Create application to generate a series of random numbers

Create the application to generate a series of 100 random numbers in the range of 1 through 1000. Save the series of numbers in a file.

  Write program which reads in side of a square

Write a program which reads in side of a square and then prints that square out of asterisks. Program must work for hollow squares of all side sizes between 1 and 20.

  Write program to compute volume flow rate

Write program to compute volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second.

  Write program to enter name-number of planet from sun

Write down the program which permits the user to enter name of planet, and then prints message stating that planet's number when counted outward from sun.

  C++ programming using depth-first search

How to solve maze using c++ programming using depth-first search" approach and also a shortest path

  Deleting and recovering the shell path variable

Deleting and Recovering the Shell PATH Variable, uppose a CIS255 student was experimenting with shell variables and accidentally deleted his / her PATH variable. The student decided he / she does not need the PATH variable.

  Two-level memory cache hierarchy

Explain how you would pipeline the four following pairs of statements.

  1 what were the key learnings surprises realized during

1. what were the key learnings surprises realized during the implementation of the first phase of outsourcing to

  Logic for a program that allows a user to enter 15 numbers

Design the logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered

  Write a java program to generate random number

Write a java program to generate random number between 45 and 56 inclusively?

  Produce the necessary instructions to swap the values

Assume variables x and y are stored in memory locations 100 and 101. Using machine language instructions from section 5.2.4, produce the necessary instructions to swap the values of x and y.

  Produce a project plan

Produce a project plan and an interim description of the project development

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd