18 PrintLn("Chose an operation to perform: +, -. q to quit.");
25 case '+': case '-': case 'q':
29 PrintLn("Invalid Operation");
35 KnownColor GetOperand()
40 while(!operand.OnGetDataFromString(input))
42 Print("Please enter a known color (black, red, green, blue, yellow, magenta, cyan or white)");
48 KnownColor ComputeOperation(char operation, KnownColor operand1, KnownColor operand2)
52 case '+': return operand1 + operand2;
53 case '-': return operand1 - operand2;
57 class Lab5ColorsApp : Application
63 KnownColor operand1, operand2;
64 char operation = GetOperation();
65 if(operation == 'q') break;
67 PrintLn("Enter the first operand:");
68 operand1 = GetOperand();
69 PrintLn("Enter the second operand:");
70 operand2 = GetOperand();
72 KnownColor result = ComputeOperation(operation, operand1, operand2);
73 PrintLn(operand1, " ", operation, " ", operand2, " = ", result);