In a galaxy far away, the STAR organisation manages a number of resorts offering space travel and recreation facilities. These resorts always consist of a number of worlds offering different leisure facilities. Each world is connected by shuttles to some of the other worlds of the resort. A card must be used to make a shuttle to journey to another world. Credits can be bought for cards and these are used when making a shuttle journey. However, there are a number of conditions which need to be met before anyone (card) can use a card for a shuttle journey.
Recently, a number of incidents have occurred, which have convinced STAR that they need a better control system: someone who needed to be contacted urgently could not be located, a number of people were able to shuttle to worlds to which they were not entitled, and the Health & Safety Council has expressed concerns about STAR’s ability to ensure peoples’ safety in the event of a major incident. This project will initially be implemented at the Wayward Asteroids Resort (and then rolled out to other resorts).
System Requirements
People will be tracked using their cards
1. The following basic functional requirements have been established for the proposed system:
2. The followingdata requirements have been established:
Card– used by people at the resort for travel.
Information stored about a card includes: a card ID number, name, a luxury rating and a number of credits.
The Card class constructor uses parameters to set the card id, the name, the luxury rating and the number of credits. The luxury rating (1 to 10) determines the worlds which the person is allowed to visit e.g. a card with a rating of 3 is allowed to visit to all worlds rated 3 or below.
When a card is used to make a journey by shuttle a basic 4 credits is deducted. as people enter the shuttle. For some special types of cards this charge may vary (more later). People may top up their credits at any time. (Handling the actual payments is outside the scope of this project)
World – a resort has a network of worlds
Each world has a reference number, a name, a rating and a capacity (the maximum number of people/cards that can be on the world at any one time). Each world should maintain a list of all cards currently on that world. These lists should be updated whenever a card enters or leaves a world, so that it is always possible to say who is currently on a world and to find the location of a person as specified by their card
Shuttle– connects two worlds at the resort
Each shuttle has a journey code and connects a source world to a destination world. It represents a journey in one direction only. To make a shuttle journey, certain conditions must be met. If these conditions are met, the system allows the person onto the shuttle to travel to the destination world. It updates its records to show that a card has left the source world and has travelled to the destination world. It also updates the card's credits and other information, as appropriate.
A request by someone(card) to make a shuttle journey will produce one of the following results:
These conditions can be handled by the Shuttle, calling methods in Card, or World classes
Successful entry, because none of the above conditions is true
Resort - implements the STARS interface
Each resort has a network of worlds joined by one-way shuttles. It also has a collection of cards
A resort must always have a “Home” world which stores all cards. Its name MUST be "Home" and it MUST have a rating of 0 and a large maximum capacity. All cards registered at a resort are initially added to this “Home” world.
You should assume that in this initial version of the system, credits are only used to cover the costs of shuttle journeys. A card arriving or leaving the resort is also outside the scope of this assignment.
Paired Programming- this assignment may be done Individually or optionally in Pairs
Produce a BlueJ project implementing a version of STARS by completing tasks described below. Your project must be capable of running correctly on the software used in UH labs.
Marks awarded for tasks below total 120. Your mark will be then converted to a %
class Cardshould have, at least:
You may add further methods, if you consider them useful
class CardTester- which can be run to show that the Card class works properly. It should:
class Worldshould include:
This is a basic list of methods and you may add more if you require them. You should NOT have mutators which change the basic information about a world ( reference number, name, luxury rating as these should not change)
classShuttle should include:
suitable fields as specified above. The "from" world and the "to" world should be World objects
a small range of accessors/mutators to process data held by the class
method which returns a boolean saying whether a card given as a parameter can enter the shuttle
a method to process a card moving to the destination world;
if the card meets the conditions, remove it from the source world, add it to the destination world, update information on the card, and returna suitable message
if it does not meet one of the conditions, returnan appropriate message and do NOT move it
a method toString()which returns a Stringrepresentation of an object of that class (no need to list all of the world details, just the world 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
class Resort - provides all of the basic functionality for this application.
This class implements the STARS interface. If you are unable to provide a full implementation of STARS in your Resort class, comment out unimplemented methods of STARS, so that Resort compiles
You must NOT change the signatures of any methods in the STARS interface - you will be penalised
Implementing the STARS 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.
Fields:
Constructor:- should create a resort located in the Wayward Asteroids as given in the Appendix below
travel()and canTravel() carry the majority of marks in this task. They should return an appropriate message for the outcome. They should include a message if either the card or the shuttle are NOT part of the resort.
Helpful methods
[3 private methods at the end of this class , to find and return each type of object (shuttle, pass, world) from its collection using key data, may be useful, but not required]
You can test your code by running the ResortUI but you will eventually find this tedious. So:
Other than MyTesterand CardTester, you are NOT required to write testers for the other classes
Marks for this task will be awarded for:
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.
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 (Resort is well documented)
Provide the following subclasses which extend the Card class.
All should have a toString() method which overrides toString() in Card to include subclass data
Tourist card:
Business card
Staff card
After the assignment hand-in, you will be asked to access your submitted assignment and a written demo specification. In a timed slot of 1 hour 50 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:
Marks for the demonstration will be for code which performs the tasks, not for producing correct output.