자바입니다
어느 회사에 근무하는 직원들을 저장하고 관리하기 위한 클래스를 생성하고, 각 직원들의 신상 정보를 입력할 수 있는 프로그램을 작성하시오. - 두개의 클래스 파일 생성:
*Employee: 직원 정보 관리 클래스
* EmployeeTest: main() 함수가 있는 클래스
- Employee 클래스 구현 내용
*나이 입력 함수: public void setAge(int age)* 직위 입력 함수: public void setPosition(String position)
* 이름 입력 함수: public void setName(String firstname, String lastname) - First name과 last name을 하나의 문자열 변수에 저장함 *월급 입력 함수: 한 명의 직원 정보 출력 함수:
- 이름, 나이, 직위, 월급 순으로 모두 출력 이름 출력 함수: *월급 출력 함수: *직위 출력 함수:
- EmployeeTest 클래스 구현 내용 메뉴 출력 및 선택 메뉴에 대한 Employee 클래스의 함수 호출
최대 4명의 직원 정보를 저장할 수 있도록 클래스 배열 사용 4명의 직원 정보는 사전에 입력하면 됨 (Employee 클래스 활용)
이런 내용의 과제인데요. 배열에 정보를 어케 저장할지 모르겠구요. 지금까지 맞게 했는지도 모르겠어요.
5년만에 복학해서 기초가 없는데 졸업은 해야해서 억지로 듣고있는데 넘 어렵네요 ㅠ.ㅠ 살려주세요
import java.util.Scanner;
class Employee{
public void menu() {
int select = 0;
Scanner K = new Scanner(System.in);
while(select!=5) {
System.out.println("1.Display all positions");
System.out.println("2.Display all salaries");
System.out.println("3.Display all employees name");
System.out.println("4.Display all information");
System.out.println("0.Quit");
System.out.println("선택>>>");
select=K.nextInt();
switch (select) { // 조건
case 0: // 값 불일치(미실행)
System.out.println("종료합니다.");
return;
case 1: // 값 일치
AP(); // 실행
break; // 종료
case 2:
System.out.println("2");
break;
case 3:
System.out.println("3");
break;
case 4:
System.out.println("4");
break;
}
}
}
int employeeAge;
String employeePosition;
String employeefirstname, employeelastname;
int employeeSalary;
public int getAge() {
return employeeAge;
}
public void setAge(int age) {
this.employeeAge= age;
}
public String getPosition() {
return employeePosition;
}
public void setPosition(String Position) {
this.employeePosition = Position;
}
public String getfirstname(String firstname) {
return employeefirstname;
}
public String getlastname( String lastname) {
return employeelastname;
}
public void setfirstName(String firstname) {
this.employeefirstname = firstname;
}
public void setlastName(String lastname) {
this.employeefirstname =lastname;
}
public int getSalary() {
return employeeSalary;
}
public void setSalary(int salary) {
this.employeeSalary=salary;
}
public void Employee(int age, String Position, String firstname, String lastname, int salary ) {
this.employeeAge=age;
this.employeePosition = Position;
this.employeefirstname = firstname;
this.employeefirstname =lastname;
this.employeeSalary=salary;
}
public void AP() {
System.out.println("position:" + getAge());
}
}
public class test {
public static void main(String[] args) {
int age[];
age = new int [4];
String[] firstname = new String[4];
String[] lasttname = new String[4];
int salary[];
salary = new int[4];
Employee employee = new Employee();
employee.menu();
}
}