You are on page 1of 9

TASK 1.

Implement and test the Pass class

 class Pass should have, at least:


 the fields described above
Code explains the implementation of a corona research exit and access
monitoring system using ArrayList. This application has a provision to insert,
modify, delete, and display staff records such as pass name, moves, door
number, left hours. The records are stored in an ArrayList. Arraylist is a class in
Blue Java that implements the List interface. Array list offers to store data in an
array format and it is very flexible to sort, modify records .
 a constructor to set all fields values, using either parameter values, or default
values (see above)
When you use a class that has already written for you in an array then
constructor set the values in their attributes using in the parameter value, or
default and null value
 accessors to return the pass id, the protection rating, allowable hours left and
moves made
constructor set the all values than accessors in the return form of pass id, and
protection rating levels of patients, allowed the hours lest of their job, and
moved 1 made.
 methods to deduct hours from hours left and increment moves
In this method, I have tostring() method use for deduct hours from hours left and
increment moves how made.
 a method to reset hours left to allowable hours and moves back to zero
When a pass is end level on available hours and moves then automatically back
to zero.
 a toString() method returning a String with all relevant information about the
pass
In this string, show the data about returning and 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
a pass ID number, staff name, protection rating, the allowable working hours,
number of hours left to work and the number of moves made .
 and call their methods: When attributes or parameters are completed then call
their methods given by the constructor.

 show that actual results are as expected


Register a pass with records such as pass name, address, moves, doors, left
hours.
2. Update pass details
3. Display pass details
4. Remove inactive pass.
Task 2 - Implementing other lower-level classes
Tester classes for these classes are NOT required but you might find it beneficial to
write them
 class Room should have:
 the fields described above.
 a constructor to create a room with suitable parameters
Registration: This module helps in registering information about pass and
handling both IPD and OPD pass query. A unique ID is generated for each pass
after registration. This helps in implementing customer relationship
management and also maintains medical history of the hospital.
 accessors to return its room number, name, danger rating and hours limit
In this module, pass accessors to return its room, danger rating about patients,
name, and hours limit.
 an ArrayList field to store Pass object references. (declared and created)
Administration or mutator: This module handles all the pass entry details for the
functional requirement such as pass id, doors, danger rating, hours left.
 mutator enter() which has a Pass as a parameter and adds it from the ArrayList
This mutator module see that which pass parameters like pass id pass name,
hours left, rating, moves.
 mutator leave()which has a Pass as a parameter, finds its position in the
ArrayList and then removes using position.
Leaves() in this class pass has enter through the door then move count
automatically and then call the leave class in ArrayList().
 an accessor which either says whether the room is full (reached capacity) (or
still has capacity)
 in this class, tell the accessor about room details and room is full or not whether
the room is full (reached capacity) (or still has capacity).
 method to list all the Passes currently in the room,
In this method, show the list about the currently passes in the room means that
how many passes present in the room.
 methods to find and return details of one pass in the room
This method call the Arraylist() and show the list about return details about the
one pass in the room
 an accessor which returns a boolean saying whether a pass is in the room (in
the ArrayList)
In this module of accessor tell them the returns details about the pass and
whether a pass currently present in this room or not. Using Boolean saying the
answer in simple yes or no.
 a toString () method which includes room details and a list of the passes in the
room

 class Door should include:


 suitable fields as specified above.
 Note: the "from" room and the "to" room should be Room object
Room objects already including from and to because, when accessor fetch the
data from room and post the data to room using these methods.
 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 eventually, when a pass has given parameter cand
move through door automatically add 1 move in the pass.
 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)
Task 3 - Implementing the Institute class
class Institute - provides all of the basic functionality for this application.
This class implements the CREAM interface.
I can add methods are necessary, but they specified as private

 Implementing the CREAM interface


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

 In Institute, you are expected to declared fields and add the code for the methods
listed.
 "Stubs" for accessors currently return default values; replace them with appropriate
values
 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)
ArrayList1() in this array details about all the passes.
ArrayList2() in this array save the details about all the rooms.
ArrayList() in this array hold the details about all the doors.
 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, which return each type of object (door,
pass, room) from its collection using key data, may be useful, but not required]

Task 4 - Implementing an application


 class InstituteUI - this is the class which provides an application for the user
 only this class and the Tester in Task 6 should use System.out.println
 this is the only class which has input and output from/to the user
perspective of application implementation user enters the data according to the
application interface.
 some of the code has been written for you
class pass
{
String pid, pname, moves, doors, hours;
int age;
void new_pass()
{
Scanner input = new Scanner(System.in);
System.out.print("id:-");
pid = input.nextLine();
System.out.print("name:-");
pname = input.nextLine();
System.out.print("moves:-");
moves = input.nextLine();
System.out.print("doors:-");
doors = input.nextLine();
System.out.print("hours:-");
hours = input.nextLine();

}
 you should provide the remaining code as shown by the comments

class accessor
{
String fecility;
int pass_details;
void new_details()
{
Scanner input = new Scanner(System.in);
System.out.print("pass:-");
pass = input.nextLine();
System.out.print("new_details:-");
New_details = input.nextInt();
}
void feci_list()
{
System.out.println(fecility + "\t\t" + accessor);
}
}
Task 5 - System Documentation
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 6 - System Testing


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

 Write a Tester 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.
class Tester
{
String tid, tname, desg;
int salary;
void new_Tester ()
{
Scanner input = new Scanner(System.in);
System.out.print("id:-");
tid = input.nextLine();
System.out.print("name:-");
tname = input.nextLine();
System.out.print("desigination:-");
desg = input.nextLine();
System.out.print("salary:-");
salary = input.nextInt();
}
void staff_info()
{
System.out.println(tid + "\t" + tname + "\t" + salary);
}
}

 Other than Tester and PassTester in Task 1, NO need to 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 7 – Additional Functionality - Challenge tasks


These tasks are designed to provide additional challenge. You will only get marks for this
task if you complete tasks 1 - 5 to a reasonable level and a specific task at the demo

 Add the following methods to the Institute class.


 resetPass – which has a pass id as a parameter, finds it and resets it
 moveOutside - which remove a pass from itscurrent room directly to the Outside
 evacuateAll- which remove all cards back to the Outside
class institute
{
String insid, desg, resetpass, moveoutside, evacuteall;
int salary;
void institute()
{
Scanner input = new Scanner(System.in);
System.out.print("insid:-");
insid = input.nextLine();
System.out.print("desigination:-");
desg = input.nextLine();
System.out.print("evacutedall:-");
evacutedall = input.nextLine();
System.out.print("resetpass:-");
resetpass = input.nextLine();
System.out.print("moveoutside:-");
moveoutside = input.nextInt();
}
void institution_info()
{
System.out.println(insid + "\t" + moveoutside + "\t" + evacutedall);
}
}

Task 8 - Demonstration
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.

Output Screenshot:

You might also like