Last active
September 24, 2015 20:42
-
-
Save 0x8801/93eb649af1eb49924b22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Drive { | |
public class GermanVehicles { | |
String cost = "high"; | |
String speedometer = "kilometers" | |
int maxSpeed = 280; | |
int currentSpeed; | |
} | |
interface Safety { | |
public void speedWarning(); | |
public void activateSpeedGovernor(int speed); | |
} | |
public class MercedesBenz implements Safety extends GermanVehicles { | |
public void speedWarning(){ | |
System.out.println("The Benz is going too fast. Please slow down"); | |
} | |
public void activateSpeedGovernor(int speed){ | |
currentSpeed = maxSpeed - speed; | |
System.out.println("Benz slowed down to " + currentSpeed); | |
} | |
} | |
public static void main(String[] args) { | |
MercedesBenz S550 = new MercedesBenz(); | |
while(1){ | |
if(currentSpeed==maxSpeed){ | |
S550.speedWarning(); | |
S550.activateSpeedGovernor(50); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment