代写C C++ Java Python 视频讲解客服在线客服在线

代做国外C C++ Java程序 Python QQ 2365427650 Email 2365427650@qq.com 免费咨询编程问题

« dynamic memory in a C programIntermediate Programming »

CALM

Background

The Corona Institute, which is engaged in vital medical research, wishes to monitor and control access to the rooms and labs in its research division. This facility has a number of rooms connected by doors. Due to "social distancing" the doors are one-way only, providing a link FROM one room TO another. All rooms also have an emergency one-way door to the Outside, which can be used at any time. The doors are controlled by inserting a "Pass" into a pass reader which controls whether the doors will open to let staff through to the room on the other side, or not.

  7COM1015 Cwk : Corona Access & Location Monitoring (CALM)

Staff members have a Pass which specifies the protection level of their personal equipment and the allowable number of hours which they can spend in the research facility in one day. They use their pass to control the doors. Each room has a danger rating. Staff are only allowed into the room if the protection level on their pass is greater than or equal to the danger level of the room they wish to enter. There are also a number of other safety regulations.

 

The Corona Institute must at all times know who is where in the research facility, in case an emergency occurs and personnel need to be evacuated.  In addition, it is vital that staff keep to health and safety regulations and do not exceed the number of hours allowed by the pass they have. When staff leave the research facility at the end of the day, their passes are reset to their allowable hours and zero moves,

 

System Requirements

A. The following basic functional requirements have been established for the proposed system:       

· List the location of all passes in all rooms at the Institute

· List all passes currently in a specified room

· Find the current location of a pass

· Authorise a door to open, if the required conditions are met

· Maintain information about hours worked and moves made  using a pass

· Reset passes

· Display information about passes

 

B. Your application will have the following classes:

· Pass – used by staff for moving between rooms.

A pass includes: a pass ID number, staff name, its protection rating, the allowable working hours, number of hours left to work and the number of moves made.

 

The Pass class constructor uses parameters to set the id, protection protection rating and allowable hours. It also sets the number of moves to zero and the number of working hours left to allowable hours. The protection protection rating (1 to 10) determines the rooms which the person with a pass is allowed to enter e.g. a pass with a protection rating of 3 is allowed to enter to all rooms with a danger rating of 3 or below.  

 

Each move through a door increments "moves" by 1 and deducts a number of hours from hours left. To minimise contamination, staff are limited to 6 moves in one day. At the end of the day, passes are reset so that moves is set to zero and the hours left to allowable hours.

 

· Room – an Institute has a network of rooms

Each room has a room number, a name, a danger rating, a capacity (the maximum number of passes that can be in the room at any one time) and the minimum allowable hours which a pass must have to enter a room. If the allowable hours left on a pass < the room's minimum hours, staff will not be allowed into the room.

 

Each room should maintain a collection of passes currently in that room. This collection should be updated whenever a pass enters or leaves a room, so that it is always possible to say who is currently in a room and to find the room that a pass is in.

 

 

· Door – connects two rooms at the Institute

Each door has a number and connects a "from" room and a "to" room. It allows a move in one direction only. To make a move, certain conditions must be met.  If these conditions are met, the system allows the person with the pass through the door to move to the "to" room. It updates its records to show that a pass has left the "from" room and has gone into the "to" room. It also updates the pass's hours left by using the destination room's minimum hours and add 1 to the number of moves on the pass

 

A request for a pass to move through a door to a room, will produce one of the following results:

· Refuse entry, because ONE of the conditions below are true

· the pass's protection rating is less than the danger rating of the "to" room.

· the pass has insufficient hours left for work in the "to" room  (allowable hours < room's hours)

· the arrival of the pass would exceed the maximum capacity of the "to" room.

· the pass is NOT listed in the "from" room of the door

· the pass has reached the 6 moves allowed

· the pass id is NOT in the system

· the door number is NOT in the system

These conditions can be handled by the Door, by calling methods in Pass, or Room classes

 

· Successful entry to the room, because none of the above conditions is true

Institute - implements the CALM interface

The Institute has a network of rooms joined by one-way doors. It also has a collection of passes. An Institute must always have a room.100 with the name  "Outside" ,  a danger rating of 0 and a large maximum capacity. All passes at an Institute are initially added to this “Outside” room 100

 

The Assignment

Produce a BlueJ project implementing a version of the CALM system by completing tasks described below.  Your project must be capable of running in BlueJ.

 

· Your CALM project should display the qualities associated with good program design:

· Your system should minimise code duplication and be modularised so that components have low coupling and high cohesion..

· You should aim to make your code reusable and easy to maintain.

· Program code should be well documented, displaying both agreed standards of internal documentation.

· Marks shown for each task include marks for both functionality and design.

· Your project must compile. Code which does not compile may be included as comments

· You must attend the online timed demo session. If you do not attend, you will get ZERO marks.

 

Assignment Tasks -  Marks awarded for tasks below total 120. 

 

Task 1  - Implement and test the Pass class 15 marks

· class Pass should have, at least:

· the fields described above

· a constructor to set all fields values, either using parameter values, or to default values (see above)

· accessors to return the pass id, the protection rating, allowable hours left and the number of moves made

· methods to deduct hours from hours left and increment moves

· a method to reset hours left to allowable hours and moves back to zero

· a toString() method returning a String with all  relevant information about the pass

You may add further methods, if you consider them useful

 

· class PassTester - which can be run to show that the Pass class works properly. It should:

· create some suitable Pass objects

· and call their methods

· show that actual results are as expected

Task 2  - Implementing other lower level classes 20 marks

There is NO need to write tester classes for these classes, but you could try to BenchTest them to check they work.

 

· class Room should have :

· the fields described above.

· a constructor to create a room with suitable parameters

· accessors to return its room number, name, danger rating and hours limit

· an ArrayList field to store Pass object references.. (declared and created)

· mutator enter() which has a Pass as a parameter and adds it from the ArrayList

· mutator leave()which has a Pass as a parameter, finds its position in the ArrayList and then removes using position.

· an accessor which either says whether the room is full (reached capacity) (..or still has capacity)

· method to list all the Passes currently in the room,

· methods to find and  return details of one pass in the room

· an accessor which returns a boolean saying whether a pass is in the room (in the ArrayList)

· a toString () method which includes room details and a list of the passes in the room

· This is a basic list of methods and you may need to add some more if required

 

· class Door should include:

· suitable fields as specified above.  Note: the "from" room and the "to" room should be Room object

· a small range of accessors/mutators to process data held by the class

· method which returns a boolean saying whether a Pass given as a parameter can move through the door

· a method to process a pass moving to the destination room;

if the pass meets the conditions, remove it from the source room, add it to the destination room and update information on the pass,, and return a suitable message

if it does not meet one of the conditions, return an appropriate message and do NOT move it

· a method toString()which returns a String representation of an object of that class (no need to list all of the room details, just the room numbers and names)

 

Without these classes you will find it difficult to develop the remaining classes. You may add further fields/methods to these classes if you require them during further development 

 

VERY IMPORTANT NOTE: these lower level classes should NOT be using System.out.println()

.

 

Task 3  - Implementing the Institute class 20 marks

class Institute - provides all of the basic functionality for this application.

This class implements the CALM interface .

You must NOT change the signatures of any methods in the CALM interface - you will be penalised

 

· Implementing the CALM  interface

We have prepared this for you by copying the methods specified in the interface and replacing the ; with "stubs"  where you can write your code.

 

· In Institute, you are expected to declared fields and add the code for the methods listed.

· The "stubs for the accessors currently return default values; you should replace these with relevant returns

· You may add any further methods you consider necessary, BUT these additional methods must have the modifier private, so they cannot be used in client classes

· Most of the methods in this class should call/invoke methods on objects of the lower classes

· Methods should NOT deal with any input/output, but use parameters and return value

· The largest portion of marks in this task are for the methods: canMove() and move()

 

· Fields:

· ArrayLists of all passes, all rooms and all doors  (3 ArrayLists)

· the position of a door in the ArrayList of doors should the same as its number.

· In the Arraylist of rooms, “Outside” room should always be at ArrayList location 0.

        

· Constructor:

· should call/invoke the three private methods defined at the end of the class to implement the Corona Institute described in Appendix A (below)

· loadPasses - should create all passes and add them to their collection

· loadRooms - should create all the rooms in and add them to the collection of all rooms. These should be added in the order of their numbers

· setUpDoors – should create all doors and add them to their collection

· Finally, the constructor should add all of the passes to the “Outside” room

.  

· Helpful methods

[3 private methods at the end of this class fi, which return each type of object (door, pass, room) for its collection using key data,  may be useful, but not required]

 

 

Task 4 - Implementing an application 8 marks

· class InstituteUI - this is the class which provides an application for the user

· only this class and the Tester in Task 5 should use System.out.println

· this is the only class which has input and output from/to the user

· some of the code has been written for you

· you should provide the remaining code as shown by the comments

 

 

 

Task 5 - System Testing 12 marks

You can test your code by running the InstituteUI but you will eventually find this tedious.  So:

· Write the MyTester class which declares a variable of class Institute

· doTest() method in Tester  calls appropriate methods on the Institute variable in a way which tests this class and demonstrates that it works according to specification. This method should include appropriate output to the terminal window. Use comments to explain what is being tested.

 

· Other than MyTester and  PassTester in Task 1,  you should NOT write testers for the other classes

 

· Marks for this task will be awarded for:

· the appropriate choice of data,

· the sequencing of method calls

· appropriate output

· explanations of tests.

 

We are looking for evidence of a systematic approach to testing and will expect you to show that you have identified and tested for the main events likely to occur when the system is running.

 

 

 

Task 6 - System Documentation 5 marks

You should produce:

· a visually neat and readable UML-style class diagram of your system as a screenshot from BlueJ

 

· program code should be well documented, displaying agreed standards of internal documentation and naming conventions. No need for detailed comments on method code (Institute is already well documented)

 

 

 


Task 7 – Inheritance 15 marks

Provide the following subclasses which extend  the Pass class.

All should have a toString() method which overrides toString() in Pass to include subclass data

· Researcher

· includes the code and the name of their project team

· has an accessor to return the project team name

 

· TeamLeader

· includes the number of staff in their team and a budget

· has mutators to update both the number of staff and the budget

· sets protection level to 10

 

· Assistant

· includes the name of their supervisor

· has a mutator to change their supervisor

· sets allowable working hours to 7

 

Now add an object of each class (using your own data) to the passes in the Institute method loadPasses()and check the everything compiles and works for these objects

 

 

 

Task 8 - Demonstration 25 marks

On the day after the assignment hand-in, you will be asked to demonstrate that you have a good working knowledge of the code that you submitted. This will require you to have remote access to Studynet and to BlueJ on your machine at a specified time. You will be asked to access your assignment and a written demo specification.  In a timed slot of 1 hour 40 mins, you will be asked to make specified changes and upload your amended code to the Demo assignment slot.

 

The main purpose of the demonstration is to authenticate your code by showing that you know it well enough to use it and make these changes. If you do not undertake this demonstration , your assignment will get ZERO marks.

 

You may be asked to:

· add a specified class which used the Pass class

· write a demo class to test the functionality of your system

· add a a new specified class

· amend Institute to create a Institute with small changes to the Corona Institute

· add a method to a class

 

Marks for the demonstration will be for code which performs the specified tasks, not for producing correct output.

 

 

 

 

 

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Walle Build 100427

Copyright 代写C.