이벤트 종류 4가지
-일회성 이벤트
생일, 식사약속, 회의 등
-기간이 지정된 이벤트
시험기간, 축제기간 등
시작일과 종료일이 있는 경우
-데드라인이 있는 이벤트
시작일은 없고 데드라인이 있는 일
제출기한이 있는 과제, 종료일이 있는 프로젝트 등
-------------------------------------위의 3종류 이벤트기능 개발 예정-------------------------------------------------
-주기적 이벤트
수업시간 등
1. 이벤트 추가 기능 종류별 3가지
2. 모든 이벤트를 출력하는 기능
3. 특정 날짜에 걸치는 이벤트들을 출력해주는 기능
package chapter3;
import java.util.Scanner;
public class Scheduller {
public Event[] events = new Event[100];
int n1=0;
public void processCommand() {
Scanner kb = new Scanner(System.in);
while(true) {
System.out.print("$ ");
String command = kb.next();
if(command.equals("addevent")) {
}
else if(command.equals("list")) {
}
else if(command.equals("show")) {
}
else if(command.equals("exit")) {
break;
}
}
kb.close();
}
public static void main(String[] args) {
Scheduller app = new Scheduller();
app.processCommand();
}
}
메인 함수가 있는 클래스
기본 틀만 구현하였다!
package chapter3;
public class Event {
public String title;
public Event(String title) {
this.title = title;
}
}
이벤트 클래스
package chapter3;
public class MyDate {
public int year;
public int month;
public int day;
public MyDate(int y,int m, int d) {
year = y;
month = m;
day = d;
}
public String toString(){
return year + "/" + month + "/" +day;
}
}
데이트 클래스(날짜)
package chapter3;
public class OnedayEvent extends Event {
public String title;
public MyDate date;
public OnedayEvent(String title, MyDate date) {
super(title);
this.title = title;
this.date = date;
}
public String toString() {
return title+ ", "+date.toString();
}
}
일회성 이벤트 클래스
package chapter3;
public class DurationEvent extends Event {
public MyDate begin;
public MyDate end;
public DurationEvent(String title, MyDate b, MyDate e) {
super(title);
begin =b;
end = e;
}
public String toString() {
return title+", "+begin.toString()+"~"+end.toString();
}
}
기간이 있는 이벤트 클래스
package chapter3;
public class DeadLineEvent extends Event {
public MyDate date;
public DeadLineEvent(String title, MyDate date) {
super(title);
this.date = date;
}
public String toString() {
return title+","+date.toString();
}
}
데드라인이 있는 이벤트 클래스
구현을 하였다.
세부적인 메인부분과 추가해줘야 할 부분에 대해서 다음 포스트에 포스팅 할 예정이다.
'알고리즘 with 자바 > 자료구조' 카테고리의 다른 글
| 추상클래스와 인터페이스 1 (0) | 2021.07.07 |
|---|---|
| 클래스 object와 Wrapper 클래스 (0) | 2021.07.06 |
| 상속 3 (0) | 2021.06.30 |
| 상속 2 (0) | 2021.06.29 |
| 상속 1 (0) | 2021.06.29 |