혹은 민식이법으로 배워보는 Java
public class Outlaw { // 너는 씨발 범죄자새끼
private int speedLimit = 0; // 도로 속도제한
private int yourSpeed = 0; // 니 속도
private boolean isOnSchoolZone = false; // 어린이보호구역 여부
private void onDrive(int speed) { // 운전시 callback
yourSpeed = speed;
}
private void onEnterSchollZone(int speedLimit) { // 어린이보호구역 진입 callback
isOnSchoolZone = true;
this.speedLimit = speedLimit;
}
private void onExitSchollZone(int speedLimit) { // 어린이보호구역 나감 callback
isOnSchoolZone = false;
this.speedLimit = speedLimit;
}
private void onAccidentHappened(boolean isKidDead) { // 사고 발생시 callback
float years = getSentencedYears(isKidDead);
if (years > 0)
beImprisoned(years);
}
private float getSentencedYears(boolean isKidDead) { // 형량 계산
float years = 0; // 기본 형량은 없음(0)으로 간주
if (isGrossNegligence()) {
years += 1.5; // 다치면 1.5년. 사고가 났는데 안 다칠리가
if (isKidDead)
years += 1.5;
if (speedLimit <= yourSpeed) // 제한속도 준수 여부
years += 1; // 어기면 형량 추가(랜덤)
// 기타 등등으로 가중처벌...
}
return years;
}
private boolean isGrossNegligence() { // 중과실 판별 여부
if (isOnSchoolZone) // 응 스쿨존이면 무적권 중과실
return true;
return false; // 다 통과하면 중과실 아님
}
private void beImprisoned(float years) { // 너 감옥
System.println( years + "년 수감");
}
}
덧글