Sample Run
assignment description
This file shows the expected output
of the A04 program.
You should not see any FAIL
messages.
Note that you might have mistakes even if there is no FAIL message.
You need to make sure that the
bag now ==
lines are as they're supposed to be.
Also note that the last section of main
has no output.
It's important that the code compiles
(no red squigglies)
and that the program doesn't crash.
Either of those indicate a problem with your solution.
[].addAll([A, E, I, O, U])
returned true
bag now == [A, E, I, O, U]
[A, E, I, O, U].addAll([A, B, C, D, E, F, G, H])
returned true
bag now == [A, E, I, O, U, A, B, C, D, E, F, G, H]
[A, E, I, O, U, A, B, C, D, E, F, G, H].addAll([])
returned false
bag now == [A, E, I, O, U, A, B, C, D, E, F, G, H]
...press enter...
[].containsAll([A, E, I, O, U])
returned false
[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z].containsAll([A, E, I, O, U])
returned true
[A, E, I, O, U, A, B, C, D, E, F, G, H].containsAll([I, J, K, L, M, N, O, P])
returned false
...press enter...
[A, E, I, O, U, A, B, C, D, E, F, G, H].removeAll([X, Y, Z])
returned false
bag now == [A, E, I, O, U, A, B, C, D, E, F, G, H]
[A, E, I, O, U, A, B, C, D, E, F, G, H].removeAll([A, E, I, O, U])
returned true
bag now == [H, G, F, E, D, A, B, C]
...press enter...
[H, G, F, E, D, A, B, C].retainAll([A, B, C, D, E, F, G, H])
returned false
bag now == [H, G, F, E, D, A, B, C]
[H, G, F, E, D, A, B, C].retainAll([A, E, I, O, U])
returned true
bag now == [A, E]
[A, E].retainAll([A, E, I, O, U])
returned false
bag now == [A, E]
[A, E].retainAll([Q, R, S, T, U, V, W])
returned true
bag now == []
...press enter...
Return to
Outline page
/
assignment description