Compare commits

..

No commits in common. "0183648b3c027e384b68a204ac608c7e80ea8f24" and "45c6e6e3d45cc47023db05caa8aa8297bf3f7cf4" have entirely different histories.

2 changed files with 10 additions and 10 deletions

View File

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

View File

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