test ? then-expr : else-expr
has exactly the same value as Racket's:
(if test then-expr else-expr)
Another way to write the tax function:
double taxConditional(double income) {
return income < 10000 ? 0.0 : income * 0.20;
}
|