April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Replace Conditional With Polymorphism (255)
nclass Viajante {
n double getBebida () {
n switch (_type) {
n case ALEMAO:
n return cerveja;
n case BRASILEIRO:
n return pinga + limao;
n case AMERICANO:
n return coca_cola;
n }
n throw new RunTimeException (“Tipo desconhecido!”);
n }
n}