728x90

 

 

 

실행 클래스

package com.kh.example.practice5.run;

import com.kh.example.practice5.model.vo.Employee;

public class Run {
	public static void main(String[] args) {

		Employee e = new Employee();
		e.setEmpNo(100);
		e.setEmpName("홍길동");
		e.setDept("영업부");
		e.setJob("과장");
		e.setAge(25);
		e.setGender('남');
		e.setSalary(2500000);
		e.setBonusPoint(0.05);
		e.setPhone("010-1234-5678");
		e.setAddress("서울시 강남구");
				
		e.getEmpNo();
		e.getEmpName();
		e.getDept();
		e.getJob();
		e.getAge();
		e.getGender();
		e.getSalary();
		e.getBonusPoint();
		e.getPhone();
		e.getAddress();
		
		int eNo = e.getEmpNo();
		String eName = e.getEmpName();
		String dept_ = e.getDept();
		String job_ = e.getJob();
		int age_= e.getAge();
		char gender_ = e.getGender();
		int salary_ = e.getSalary();
		double bonus_ = e.getBonusPoint();
		String phone_ = e.getPhone();
		String addrs = e.getAddress();
		
		System.out.println("empNo : " + eNo);
		System.out.println("empName : " + eName);
		System.out.println("dept : " + dept_);
		System.out.println("job : " + job_);
		System.out.println("age : " + age_);
		System.out.println("gender : " + gender_);
		System.out.println("salary : " + salary_);
		System.out.println("bonus : " + bonus_);
		System.out.println("phone : " + phone_);
		System.out.println("address : " + addrs);
		
	}

}

기능클래스

package com.kh.example.practice5.model.vo;
public class Employee {
	
	private int empNo;
	private String empName;
	private String dept;
	private String job;
	private int age;
	private char gender;
	private int salary;
	private double bonusPoint;
	private String phone; 
	private  String address;
	
	// 기본 생성자
	public Employee() {

	}
	
	public Employee(int empNo, String empName) {
		this.empNo = empNo;
		this.empName = empName;
	}
	public Employee(int empNo, String empName, String dept, String job,	int age, 
			char gender, int salary, double bonusPoint, String phone, String address) {
		this.empNo = empNo;
		this.empName = empName;
		this.dept = dept;
		this.job = job;
		this.age = age;
		this.gender = gender;
		this.salary = salary;
		this.bonusPoint = bonusPoint;
		this.phone = phone;
		this.address = address;
	}
	
	// setter
	public void setEmpNo(int empNo) {
		this.empNo = empNo;
	}
	public void setEmpName(String empName) {
		this.empName = empName;
	}
	public void setDept(String dept) {
		this.dept = dept;
	}
	public void setJob(String job) {
		this.job = job;
	}	
	public void setAge(int age) {
		this.age = age;
	}
	public void setGender(char gender) {
		this.gender = gender;
	}	
	public void setSalary(int salary) {
		this.salary = salary;
	}
	public void setBonusPoint(double bonusPoint) {
		this.bonusPoint = bonusPoint;
	}	
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
	
	// getter
	public int getEmpNo() {
		return empNo;
	}
	public String getEmpName() {
		return empName;
	}
	public String getDept() {
		return dept;
	}
	public String getJob() {
		return job;
	}	
	public int getAge() {
		return age;
	}
	public char getGender() {
		return gender;
	}	
	public int getSalary() {
		return salary;
	}
	public double getBonusPoint() {
		return bonusPoint;
	}
	public String getPhone() {
		return phone;
	}
	public String getAddress() {
		return address;
	}
	
	
	
}

 

 

728x90
반응형

+ Recent posts