Skip to content

Instantly share code, notes, and snippets.

@0x8801
Last active September 24, 2015 20:42
Show Gist options
  • Save 0x8801/93eb649af1eb49924b22 to your computer and use it in GitHub Desktop.
Save 0x8801/93eb649af1eb49924b22 to your computer and use it in GitHub Desktop.
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