Класс Task содержит логику для создания и отображения информации о задачах, а класс TodoApp демонстрирует их использование. Closes #1

This commit is contained in:
KamaSK 2025-05-17 07:10:18 +03:00
parent 7ca5445791
commit c32132a9c4
3 changed files with 36 additions and 7 deletions

View File

@ -1,7 +0,0 @@
package ru.kamask.pet;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

View File

@ -0,0 +1,23 @@
package ru.kamask.pet;
public class Task {
int id;
String title;
String description;
boolean completed;
Task(String title, String description){
this.id = 0;
this.title = title;
this.description = description;
this.completed = false;
}
void printInfo(){
System.out.println(this.title + ": " + (this.completed ? "выполнена." : "в процессе"));
}
void markAsCompleted(){
this.completed = true;
}
}

View File

@ -0,0 +1,13 @@
package ru.kamask.pet;
public class TodoApp {
public static void main(String[] args) {
Task t1 = new Task("Первая задача", "Уррааа! Первая задача!");
Task t2 = new Task("Вторя задача", "Ну, вторая уже не первая)))");
t1.printInfo();
t2.printInfo();
t1.markAsCompleted();
t1.printInfo();
t2.printInfo();
}
}