Get Your If's Straight, Man!

Let's take this method in Java:

1
2
3
4
5
6
7
public Integer getValueToPay(Client c){
    if (c.Age >= 60) {
        return ticket.getValue(true);
    } else {
        return ticket.getValue(false);
    }
}

Considering that the object ticket belongs to the same class as this method and it has a method getValue(Boolean discount), what is the minimum number of keywords that we need to use in the function body to express the exact same function?

  • Clarification: return, if, else are considered keywords.
×

Problem Loading...

Note Loading...

Set Loading...