This file shows
one example
of running the program A04.
The behaviour of the program
will change
depending on what input the user enters.
As usual,
text in blue with a grey arrow at the end
indicates user input.
The grey arrow indicates a press of the Enter key.
Return to
assignment description
Sample Output
Program A04
-----------
A program to put the Validator interface thru its paces.
Author: Mark Young (A00000000)
...press enter...
I have a validator for even numbers.
evens.isValid(2) == true
evens.isValid(3) == false
...press enter...
I have a validator for positive numbers.
positives.isValid(104) == true
positives.isValid(-3) == false
...press enter...
Please enter one integer value per line below. I will tell you whether it
meets the requirements for a Validator I have just created. (Enter a negative
number when you're finished.)
>>> 1
1 DOES NOT meet the requirements!
>>> 2
2 DOES NOT meet the requirements!
>>> 10
10 meets the requirements!
>>> 11
11 DOES NOT meet the requirements!
>>> -1
Did you guess the requirement? It's that the number be even and between ten
and one hundred (inclusive).
...press enter...
Below please enter lines of text below. If each line contains only words
between two and five characters long (inclusive), then I'll add them to a set.
(Leave a blank line when you're done.)
>>> Could you add these words
All those words are good. I'm adding them to the set.
>>> These are more words I want to add
That has an unacceptable word in it. None of them is being added.
>>> I'm glad you added the first set
All those words are good. I'm adding them to the set.
>>>
Here is the set of words I built for you:
[Could, I'm, add, added, first, glad, set, the, these, words, you]
...press enter...
Bye!
Return to
assignment description