자꾸 이런 에러가 뜨면서 실행이 되지 않습니다.
환경설정 환경변수는 모두 제대로 설정했습니다.
뭐가 문제고 어떻게 해야할까요.. 시험기간인데 큰일이에요
아래는 코드 전문입니다.
package lab6;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;
class Staff extends Person{
private int staffID;
private String dept;
private Date dateHired;
public static ArrayList<Staff> staffs = new ArrayList<>();
Staff(String n, String p, String d){
super(n, p);
dept = d;
}
void printInfo() {
super.printInfo();
System.out.println("staff id : " + staffID);
System.out.println("DATE Hired : " + dateHired);
System.out.println("dept : " + dept);
}
}
class Customer extends Person {
// Atrributes
private int customerID;
private String driverLicense;
public static ArrayList<Customer> customers = new ArrayList<>();
// Operations
Customer(String n, String p, String license) {
super(n , p);
driverLicense = license;
}
@Override
public void printInfo() {
super.printInfo();
System.out.println("customer ID : " + customerID);
System.out.println("driverLicense : " + driverLicense);
}
}
class Person {
Scanner sc = new Scanner(System.in);
// Attributes
private int personID;
private String name;
private String phone;
private static ArrayList<Person> persons = new ArrayList<>();
// Operations
Person(String n, String p) { // Constructor n : name, p : phone
this.name = n;
this.phone = p;
}
void printInfo() { //
System.out.println("person ID : " + personID);
System.out.println("name : " + name);
System.out.println("phone number : " + phone);
}
protected static void addPerson(Person p) {
persons.add(p); // add the instance of Person that received as parameter
}
protected static Boolean deletePerson(Person p) {
if (persons.isEmpty())
return false;
else {
persons.remove(p);
return true;
}
}
public void printAllPersons() {
if (persons.isEmpty())
System.out.println("ArrayList<Person> persons are empty now");
else {
for (int i = 0; i < persons.size(); i++) // print all the elements in ArrayList<Person> persons. Using
// printInfo in ArrayList element
persons.get(i).printInfo();
}
}
public class lab6 {
public static void main(String[] args) {
Customer customer1 = new Customer("heewon", "010-2323-9121", "da-2501");
Customer customer2 = new Customer("jiwon", "010-1111-1111", "da-2502");
Customer customer3 = new Customer("jisu", "010-4563-1243", "da-2503");
Customer.customers.add(customer1); Customer.customers.add(customer2);
Customer.customers.add(customer3);
Staff staff1 = new Staff("heesu", "010-2828-2828", "100000 won");
Staff staff2 = new Staff("jisun", "010-2213-2512", "1200000 won");
Staff staff3 = new Staff("mimin", "010-2828-1232", "400000 won");
Staff.staffs.add(staff1);
Staff.staffs.add(staff2);
Staff.staffs.add(staff3);
}