*Make a Java program to keep track of one row of cards that the user has to put in a correct
order. Each card has a value and a description of the order constraints. There are four sorts of
cards with their corresponding constraints on the order: "must be smaller than previous",
"must be larger than previous", "must be smaller than next", "must be larger than next".
The *user interface* should be able to show at least two consecutive cards - a complete list of
all cards is a nice extension. The minimal user actions are:
? Go to the next card.
? Go to the previous card.
? Swap two consecutive cards.
? Check whether the order constraints of all cards are satisfied.
You may extend this functionality, but you should concentrate on these actions first.
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
The program need not do any ordering itself. It just supports the user actions.
? The total number of cards is not specified. You may choose the number of cards of eachsort.
However, it should be easy to change the code in this respect, afterwards.
The four sorts of cards correspond to four different subclasses of a common superclass.
Define as much functionality as possible in the common superclass.
Each sort of cards - including the superclass - has its own implementation of a method to
check the constraints on the order. Use the same name and parameters in all five classes.
Cards need not keep track of the previous and next card - that would be too difficult.
Instead the check method of a card can receive the previous and next card as parameters.
The engine should contain an array of cards (superclass). The actual elements of this array
may be of any of the four subclasses. After the card objects have been created, the engine
need not know the actual class of any card - it is enough to know that it is just some card.
The engine is responsible for filling the row of cards with instances of the four subclasses.
The initial order of the row is not very important.
It should be impossible to move off either end of the row of cards.