In: Computer Science
A. Think of a rail-road crossing (a crossing between a road and a rail track) controller software that raises and lowers gates. This system has three components, namely, the gate (controlled by software), the crossing (along with the lights), and the controller that controls the whole system. When a train comes, the gate is lowered. The opposite happens after the train leaves. The lights indicate that a train is arriving. The gate remains lowered as long as the train is in the crossing. Once a train leaves, the lights indicate the absence of a train. Assume that the hardware is controlled by software. Write down the requirements for such an application in terms of user stories. Break this requirement up into userstory 1, userstory 2, … Identify the classes, methods, and attributes, the associations between classes, and the multiplicities of each association. You do not need to draw class diagrams
As Per Above application we have lot's of practical requirements in real world.
UserStory 1 : A person is coming from another city and wants to enter safely into a city which has railway lines crossing. He can only enter into city when Light's are Green, Gates are not Lower( should be open) Otherwise he can be in trouble while entering into city. Can you please guide this person through your controller software to cross railway line safely.
UserStory 2 : A person wants to cross Railway Line Crossing safely in minimum time.There is a Train in each 30 min and it takes 5 min in crossing. Any one can cross lines in 10min by car. He left home by car at 10.00 Am. He took 2hr to reach railway station. When he reached gates were lower and light was Red. how much time he took for entering into city. Help this person to know the status of train when he reached at railway station by your application and also time calculation.
There will be One Class called RailwayLineCrossing
this will include methods
getLightStatus() ->(will return Green or Red)
getGateStatus() -> (will return closed or opened)
getTrainStatus() ->(will return pass or crossing)
this will inclue attributes
String Light,Gate,Train;
Now,
In order to use this class, any user can call these methods and get status in there Own classes.
Also, This class can be Inherit in user class and can overrides the methods and can use it.
So, Association will be with RailwayLineCrossing class to other classes.
multiplicity for RailwayLineCrossing to other classes will be one to many.
RailwayLineCrossing can have more then one user and one user can use one RailwayLineCrossing at a time.
There can be many other application of controller software.