public class Person {
private int name;
private int age;
public Person() {
this("이름 없음",1);
}
public Person(String name, int age) {
this.name = name;
this.age = age;
}
}
EX)
public Person getPerson() {
return this;
}

예시1) Edward는 늦게 일어나 학교에 지각을 했습니다. 택시를 타고 10000원을 지불하였습니다. 이 상황을 코드에 추가해 보세요.
Student student = new Student("Edward",1,20000);
Vehicle taxi = new Taxi(100);
int DISTANCE_FROM_SCHOOL = 100;
student.takeVehicle(taxi,DISTANCE_FROM_SCHOOL);
System.out.println("남은 돈:" + student.getMoney());
예시2) 아침 출근길에 김 졸려 씨는 4000원을 내고 별다방에서 아메리카노를 사 마셨습니다.
이 피곤 씨는 콩다방에서 4500원을 내고 라떼를 마셨습니다. 코드로 구현해보시오
Person kim = new Person("김","졸려",10000);
Person lee = new Person("이","피곤",15000);
CoffeeShop starShop = new CoffeeShop("별다방");
CoffeeShop beanShop = new CoffeShop("콩다방");
kim.buyCoffee(startShop,"americano");
lee.buyCoffee(beanShop,"latte");
System.out.println("김졸려의 남은 돈:" + kim.getMoney());
System.out.println("이피곤의 남은 돈:" + lee.getMoney());
class A {
pulblic static int num = 0;
public static void plusNum() {
num++;
}
}
class B {
pulblic static int num = 0;
public static void plusNum() {
num++;
}
}