Sample Output
Return to assignment description
Here is the output you should see when you run the program A02
along with your completed Domino class.
(Of course,
my name and A-number should be replaced by yours
in the author information for the Domino class.)
As usual,
shows where the user presses the enter key.
Note:
Some lists may be in a slightly different order
each time you run the program.
These include
"Sorted by Sum" (!),
"Just Those That Sum to Seven",
and "High, Low, and Other Values".
The "Sorted by Sum"
must still have the [12|12] at the beginning
and [ 0| 0] at the end,
and tiles with larger sums must come before tiles with lower sums.
Dominoes
========
This program generates, sorts, and prints dominoes.
Program by Mark Young (A00000000)
Domino class by Mark Young (A00000000)
Natural Sort
------------
[12|12] [12|11] [12|10] [12| 9] [12| 8] [12| 7] [12| 6]
[12| 5] [12| 4] [12| 3] [12| 2] [12| 1] [12| 0] [11|11]
[11|10] [11| 9] [11| 8] [11| 7] [11| 6] [11| 5] [11| 4]
[11| 3] [11| 2] [11| 1] [11| 0] [10|10] [10| 9] [10| 8]
[10| 7] [10| 6] [10| 5] [10| 4] [10| 3] [10| 2] [10| 1]
[10| 0] [ 9| 9] [ 9| 8] [ 9| 7] [ 9| 6] [ 9| 5] [ 9| 4]
[ 9| 3] [ 9| 2] [ 9| 1] [ 9| 0] [ 8| 8] [ 8| 7] [ 8| 6]
[ 8| 5] [ 8| 4] [ 8| 3] [ 8| 2] [ 8| 1] [ 8| 0] [ 7| 7]
[ 7| 6] [ 7| 5] [ 7| 4] [ 7| 3] [ 7| 2] [ 7| 1] [ 7| 0]
[ 6| 6] [ 6| 5] [ 6| 4] [ 6| 3] [ 6| 2] [ 6| 1] [ 6| 0]
[ 5| 5] [ 5| 4] [ 5| 3] [ 5| 2] [ 5| 1] [ 5| 0] [ 4| 4]
[ 4| 3] [ 4| 2] [ 4| 1] [ 4| 0] [ 3| 3] [ 3| 2] [ 3| 1]
[ 3| 0] [ 2| 2] [ 2| 1] [ 2| 0] [ 1| 1] [ 1| 0] [ 0| 0]
...press enter...
Sorted by Sum
-------------
[12|12] [12|11] [12|10] [11|11] [12| 9] [11|10] [10|10]
[11| 9] [12| 8] [10| 9] [12| 7] [11| 8] [10| 8] [11| 7]
[ 9| 9] [12| 6] [12| 5] [11| 6] [ 9| 8] [10| 7] [ 8| 8]
[ 9| 7] [12| 4] [11| 5] [10| 6] [ 9| 6] [ 8| 7] [11| 4]
[10| 5] [12| 3] [10| 4] [11| 3] [12| 2] [ 9| 5] [ 7| 7]
[ 8| 6] [10| 3] [12| 1] [ 9| 4] [ 7| 6] [11| 2] [ 8| 5]
[ 7| 5] [ 9| 3] [ 8| 4] [ 6| 6] [11| 1] [10| 2] [12| 0]
[ 9| 2] [ 7| 4] [ 6| 5] [ 8| 3] [10| 1] [11| 0] [ 9| 1]
[10| 0] [ 6| 4] [ 8| 2] [ 5| 5] [ 7| 3] [ 7| 2] [ 9| 0]
[ 6| 3] [ 5| 4] [ 8| 1] [ 4| 4] [ 6| 2] [ 8| 0] [ 5| 3]
[ 7| 1] [ 5| 2] [ 7| 0] [ 4| 3] [ 6| 1] [ 6| 0] [ 3| 3]
[ 4| 2] [ 5| 1] [ 3| 2] [ 4| 1] [ 5| 0] [ 3| 1] [ 4| 0]
[ 2| 2] [ 3| 0] [ 2| 1] [ 2| 0] [ 1| 1] [ 1| 0] [ 0| 0]
...press enter...
Just the Fives
--------------
[12| 5] [11| 5] [10| 5] [ 9| 5] [ 8| 5] [ 7| 5] [ 6| 5]
[ 5| 5] [ 5| 4] [ 5| 3] [ 5| 2] [ 5| 1] [ 5| 0]
...press enter...
Just the Doubles
----------------
[12|12] [11|11] [10|10] [ 9| 9] [ 8| 8] [ 7| 7] [ 6| 6]
[ 5| 5] [ 4| 4] [ 3| 3] [ 2| 2] [ 1| 1] [ 0| 0]
...press enter...
Just the Double Three
---------------------
[ 3| 3]
...press enter...
Just Those That Sum to Seven
----------------------------
[ 5| 2] [ 7| 0] [ 4| 3] [ 6| 1]
...press enter...
High, Low, and Other Values
---------------------------
[ 5| 2].getHigh() == 5
[ 5| 2].getLow() == 2
[ 5| 2].getOther(2) == 5
[ 7| 0].getHigh() == 7
[ 7| 0].getLow() == 0
Refused: [ 7| 0] has no 2
[ 4| 3].getHigh() == 4
[ 4| 3].getLow() == 3
Refused: [ 4| 3] has no 2
[ 6| 1].getHigh() == 6
[ 6| 1].getLow() == 1
Refused: [ 6| 1] has no 2
...press enter...
Dealing with Unusual Situations
-------------------------------
Refused: new Domino(-1, 5) because -1
Refused: new Domino(1, -5) because -5
Refused: new Domino(100, 5) because 100
Refused: new Domino(7, 105) because 105
Refused: [ 5| 1].has(-1) because -1
Refused: [ 5| 1].isDouble(-1) because -1
Return to
assignment description