Compare commits

..

2 Commits

2 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
package ru.kamask.pet;
public class Task {
class Task {
private int id;
private String title;
private String description;
@ -12,12 +12,12 @@ public class Task {
this.description = description;
}
public void printInfo() {
void printInfo() {
String stringCompleted = completed ? "[х]" : "[ ]";
System.out.printf("%-3d | %-20s | %s\n", id, title, stringCompleted);
}
public void printInfo(boolean full) {
void printInfo(boolean full) {
if (!full) {
printInfo();
return;
@ -38,15 +38,15 @@ public class Task {
System.out.printf(template, id, stringCompleted, title, description);
}
public void toggleCompleted() {
void toggleCompleted() {
completed = !completed;
}
public int getId() {
int getId() {
return id;
}
public boolean getCompleted() {
boolean getCompleted() {
return completed;
}
}

View File

@ -13,7 +13,7 @@ public class TodoApp {
displayMainMenu();
}
public static int requestIntFromInput(String template, int[] allowedInts) {
private static int requestIntFromInput(String template, int[] allowedInts) {
do {
System.out.print(template);
int input;
@ -35,7 +35,7 @@ public class TodoApp {
} while (true);
}
public static void displayMainMenu() {
private static void displayMainMenu() {
while (true) {
String menu = """
@ -126,7 +126,7 @@ public class TodoApp {
}
public static Task getTaskById(int id) {
private static Task getTaskById(int id) {
for (int i = 0; i < tasksCounter; i++) {
if (tasks[i].getId() == id)
return tasks[i];
@ -134,7 +134,7 @@ public class TodoApp {
return null;
}
public static void displayTask(Task task) {
private static void displayTask(Task task) {
task.printInfo(true);
String firstOption = task.getCompleted() ? "[1]Не выполнено" : "[1]Выполнено";
int input = requestIntFromInput(firstOption + " [0]Главное меню\n\nВвод:",