public class MonthSchedule {
private Day[] days;
public MonthSchedule() {
days = new Day[31];
for (int i = 0; i < 31; i++) {
days[i] = new Day();
}
}
public void input(int day, String work) {
days[day - 1].set(work);
}
public void view(int day) {
System.out.println(day + "일의 할 일 : " + days[day - 1].get());
}
public void finish(int day) {
days[day - 1].set(null);
}
public void run() {
Scanner scanner = new Scanner(System.in);
int choice;
int day;
String work;
while (true) {
System.out.println("1. 할 일 입력");
System.out.println("2. 할 일 보기");
System.out.println("3. 할 일 삭제");
System.out.println("4. 종료");
System.out.print("선택 : ");
choice = scanner.nextInt();
if (choice == 4) {
break;
}
switch (choice) {
case 1:
System.out.print("날짜 입력 : ");
day = scanner.nextInt();
System.out.print("할 일 입력 : ");
scanner.nextLine();
work = scanner.nextLine();
input(day, work);
break;
case 2:
System.out.print("날짜 입력 : ");
day = scanner.nextInt();
view(day);
break;
case 3:
System.out.print("날짜 입력 : ");
day = scanner.nextInt();
finish(day);
break;
}
}
System.out.println("종료");
}
public static void main(String[] args) {
MonthSchedule schedule = new MonthSchedule();
schedule.run();
}
}
************
실패(GPT의 도움을 받고도)



