과제1

Person

package ch01;

public class Person {

	public int heigth;
	public int weight;
	public int age;
	public String name;
	
	public Person() {
		
	}
	public Person(int heigth, int weight, int age, String name) {
		
		this.heigth=heigth;
		this.age = age;
		this.weight=weight;
		this.name=name;
		
	}
	public void printinfo() {
		System.out.println("키는 "+heigth);
		System.out.println("몸무게는 "+weight);
		System.out.println("나이는 "+age);
		System.out.println("이름은 "+name);
		
	}
	
}

PersonTest

package ch01;

public class PersonTest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Person tomasInfo = new Person(180,78,20,"Tomas");
		
		tomasInfo.printinfo();
	}

}

과제2

Delivary

package ch01;

public class Delivary {
	public String orderNum;
	public String orderPhoneNum;
	public String address;
	public int date;
	public int price;
	public int menuNum;
	
	public Delivary() {
		
	}
	public Delivary(String orderNum, String orderPhoneNum,String address, int date, int price, int menuNum) {
		this.orderNum=orderNum;
		this.orderPhoneNum=orderPhoneNum;
		this.address=address;
		this.date=date;
		this.price=price;
		this.menuNum=menuNum;
	}
	public void printInfo() {
		System.out.println("주문 접수 번호: "+orderNum);
		System.out.println("주문 핸드폰 번호: "+orderPhoneNum);
		System.out.println("주문 집 주소: "+address);
		System.out.println("주문 날짜: "+date);
		System.out.println("주문 가격: "+price);
		System.out.println("메뉴 번호: "+menuNum);
		
	}
	
}

DelivaryOrder

package ch01;

public class DelivaryOrder {

	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Delivary order1 = new Delivary("202011020003","01023450001","서울 강남시 역삼동 111-333", 20201102,35000,3);
		order1.printInfo();
		
	}

}

+ Recent posts