Task_Java/Program.java
2024-06-07 18:45:22 +04:00

38 lines
1.4 KiB
Java

import java.util.Scanner;
public class Program {
public static Plans MyPlan;
public static void main(String[] args) {
MyPlan = new Plans();
while (true){
System.out.println("Введите команду:");
Scanner scanner = new Scanner(System.in);
String com = scanner.nextLine();
switch (com){
case "#write":
System.out.println("Введите ваши планы на сегодня: ");
String write = scanner.nextLine();
String[] words = write.split(" ");
if (!MyPlan.Write(words)){
System.out.println("Строка пустая");
}
break;
case "#read":
MyPlan.Read();
break;
case "#statistic":
Statistic st = new Statistic();
MyDate date = st.GetStatistic();
if (date != null){
System.out.print("Самый продуктивный день: ");
MyPlan.ReadDate(date);
}
System.out.println();
break;
default:
throw new IllegalStateException("Unexpected value: " + com);
}
}
}
}