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

  Falling letters game

Generic queue in the first project and generic list in the second project - In the second project, the player clicks the mouse on any falling letter to remove that letter from the window.

  Write a program that reads the data from the file

Write a program that - Reads the data from the file into an array of structure when the form is loaded and When "Display Hits" is clicked, based on the team selected from the list, displays the players from that team and their hits. The players are..

  Create a function that carries out the desired action

Create your own assignment to get more practice with arrays. Listed below are twenty seven functions you can write that deal with arrays. Listed next to each function is a number of points each is worth in parenthesis. Create a function that carri..

  Display the total price of the cup of coffee

Create a UseTVShow.java file that prompts the user to input up to 5 TV shows and stores the data in an array of objects first, then displays them as a list.

  Program to determines and print all prime numbers

Use this function in program which determines and prints all prime numbers between 2 and 10,000. How many of these numbers do you actually have to test before being sure that you have found all primes?

  Statement to read variables of type double

Suppose two variables p1 and p2 of type POINT, with two fields, x and y, both of type double, have been declared. Write a statement that reads values for p1 and p2 in that order.

  Design a flowchart or pseudocode

Design a flowchart or pseudocode for the following:A program that accepts a candy name (for example, "chocolate-covered blueberries"), price per pound, and number of pounds sold in the average month, and displays the item's data only if it is a be..

  Your goal in this program is to write down an address book

your goal in this program is to write an address book. your program should present the user with three menu options1.

  What are the risks associated with directly executing user

1. What are the risks associated with directly executing user input? What are the minimum steps needed to parse user input before it is allowed to be used in execution? 2. What are the risks associated with inheritance in classes? Why are generic cla..

  Javascript program that will read a message string

Write a JavaScript program that will read a message string and a number from text boxes on a Web page. The program will then use those values to display some information to the user.

  Program-visual basic to compute tips for services rendered

Write a program in Visual Basic 2010 to compute tips for services rendered. The program should request the person's occupation, the amount of the bill and the percentage tip

  Determine seperate total of positive and negative numbers

Read set of 40 positive and negative numbers entered from keyboard and determine seperate total of positive and negative numbers. How to show modular design of above statement

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