package parrot;

public class Parrot {

    private ParrotTypeEnum type;
    private int numberOfCoconuts = 0;
    private double voltage;
    private boolean isNailed;


    public Parrot(ParrotTypeEnum _type, int numberOfCoconuts, double voltage, boolean isNailed) {
        this.type = _type;
        this.numberOfCoconuts = numberOfCoconuts;
        this.voltage = voltage;
        this.isNailed = isNailed;
    }

    public double getSpeed() {
        switch(type) {
            case EUROPEAN:
                return getBaseSpeed();
            case AFRICAN:
                return Math.max(0, getBaseSpeed() - getLoadFactor() * numberOfCoconuts);
            case NORWEGIAN_BLUE:
                return (isNailed) ? 0 : getBaseSpeed(voltage);
        }
        throw new RuntimeException("Should be unreachable");
    }

    private double getBaseSpeed(double voltage) {
        return Math.min(24.0, voltage*getBaseSpeed());
    }

    private double getLoadFactor() {
        return 9.0;
    }

    private double getBaseSpeed() {
        return 12.0;
    }


}

@@ -102,12 +102,8 @@
 nuts
- = 0
 ;%0A  
@@ -159,17 +159,16 @@
 ailed;%0A%0A
-%0A
     publ
@@ -452,16 +452,17 @@
   switch
+ 
 (type) %7B
@@ -747,18 +747,37 @@
         
-%7D%0A
+    default:%0A        
         
@@ -829,16 +829,26 @@
 able%22);%0A
+        %7D%0A
     %7D%0A%0A 
@@ -933,17 +933,19 @@
  voltage
-*
+ * 
 getBaseS
@@ -1088,11 +1088,10 @@
 %0A    %7D%0A%0A
-%0A
 %7D%0A

Format Parrot.