Logic Problem Set 4

Part 1 - Raptor Programs

Logic.10 Answer Cell

Your cell phone rings. Display "Answer It!" if you should answer it. Normally you answer, except in the morning you only answer if it is your mom calling. In all cases, if you are asleep, you do not answer. Add 5 more test cases.

Test Case
Is Morning Input

Is Mom Input

Is Asleep Input
Program Output
1 0 0 0 Answer It
2 0 0 1 Don't Answer
3 1 0 0 Don't Answer

Solutions:

python

raptor

Logic.11 Tea Party

We are having a party with amounts of tea and candy. Display the outcome of the party as either, bad, good, or great. A party is good (1) if both tea and candy are at least 5. However, if either tea or candy is at least double the amount of the other one, the party is great (2). However, in all cases, if either tea or candy is less than 5, the party is always bad (0). Add 5 more test cases.

Test Case
Tea
Candy
Program Output
1 6 8 Good!
2 3 8 Bad!
3 20 6 Great!

Solutions:

python

raptor

Logic.12 Two as One

One Given three ints, a b c, display "It is possible", if it is possible to add two of the ints to get the third. Add 5 more test cases.

Test Case
a
b
c
Program Output
1 1 2 3 It is possible
2 3 1 2 It is possible
3 3 2 2 Not possible

Solutions:

python

raptor