왜 컴파일 에러가 자꾸 날까요...
메인 부분만 빼고 했는데 이상하네요..
package cose102.chap11.a;
/**
* Created by Gbong on 12/3/2016.
*/
import com.sun.org.apache.bcel.internal.generic.INSTANCEOF;
import sun.security.jca.GetInstance;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Person> list = new ArrayList<>();
int N = sc.nextInt();
sc.nextLine();
for (int n = 0; n < N; n++) {
String[] items = sc.nextLine().split("\t");
Person p = null;
if (items[4].equals("Student")) {
Student p1 = new Student();
if (items[5].equals("FRESHMAN")) p1.status = Student.FRESHMAN;
else if (items[5].equals("SOPHOMORE")) p1.status = Student.SOPHOMORE;
else if (items[5].equals("JUNIOR")) p1.status = Student.JUNIOR;
else if (items[5].equals("SENIOR")) p1.status = Student.SENIOR;
p = p1;
} else if (items[4].equals("Employee")) {
Faculty p1 = new Faculty();
if (items[5].equals("LECTURER")) p1.rank = Faculty.LECTURER;
else if (items[5].equals("ASSISTANT_PROFESSOR")) p1.rank = Faculty.ASSISTANT_PROFESSOR;
else if (items[5].equals("ASSOCIATE_PROFESSOR")) p1.rank = Faculty.ASSOCIATE_PROFESSOR;
else if (items[5].equals("PROFESSOR")) p1.rank = Faculty.PROFESSOR;
p = p1;
} else if (items[4].equals("Staff")) {
Staff p1 = new Staff();
p1.title = items[5];
p = p1;
}
p.name = items[0];
p.address = items[1];
p.phoneNumber = items[2];
p.email = items[3];
list.add(p);
}
for (Person p : list) {
System.out.println(p);
}
}
}
class Person{
String name;
String address;
String phoneNumber;
String email;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String toString(){
if(this instanceof Staff){
return name + " is Staff";
}else if(this instanceof Faculty){
return name + " is Faculty";
}else if(this instanceof Employee){
return name + " is Employee";
}else if(this instanceof Student){
return name + " is Student";
}else if(this instanceof Person){
return name + " is Person";
}
return toString();
}
}
class Student extends Person{
static String status;
static String FRESHMAN = "FRESHMAN";
static String SOPHOMORE = "SOPHOMORE";
static String JUNIOR = "JUNIOR";
static String SENIOR = "SENIOR";
public static String getStatus() {
return status;
}
public static void setStatus(String status) {
Student.status = status;
}
}
class Employee extends Person{
String office;
double salary;
Date date;
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
class Faculty extends Employee{
String hours;
String rank;
static String LECTURER = "LECTURER";
static String ASSISTANT_PROFESSOR = "ASSISTANT_PROFESSOR";
static String ASSOCIATE_PROFESSOR = "ASSOCIATE_PROFESSOR";
static String PROFESSOR = "PROFESSOR";
public String getHours() {
return hours;
}
public void setHours(String hours) {
this.hours = hours;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
}
class Staff extends Employee{
String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
저거 맨위에 import.java.Date가 안되는거아니에요??
import com.sun.org.apache.bcel.internal.generic.INSTANCEOF;
import sun.security.jca.GetInstance;
이걸 먼저 없애야 겠군요