Skip to content
Open

Lab1 #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lab-01/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lab-01/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lab-01/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions lab-01/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lab-01/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions lab-01/HelloWorld.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
В Полотняной стране По реке Простыне Плывет пароход То назад, то вперед, А за ним такая гладь — Ни морщинки не видать.
Утюг
Стоит дуб, В нем двенадцать гнезд, В каждом гнезде По четыре яйца, В каждом яйце По семи цыпленков.
Год
Музыкант, певец, рассказчик — А всего труба да ящик.
Граммофон
Из стены торчу, Головой кручу, Мою и пою Целую семью.
Душ
Под гору — коняшка, в гору — деревяшка.
Санки
Сидит в темнице, красная девица, а коса на улице.
Морковь
Зимой — звезда, весной — вода.
Снежинка
Кто зимой холодной ходит злой, голодный?
Волк
Белые поросятки прилегли на грядке.
Кабачки
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Продолжите знаменитую фразу: "Ноль, ноль, ноль и так далее ..."
Ноль
Мы считали дырки в сыре три плюс два равно
Пять
Самое большое млекопитающее
Синий кит
Какой балл нужно поставить мне за лабу
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет!

Высокий
Напишите "Прикол"
хы
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
117 changes: 117 additions & 0 deletions lab-01/src/by/Savenok/quizer/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package by.Savenok.quizer;

import by.Savenok.quizer.task_generators.TaskGenerator;
import by.Savenok.quizer.task_generators.math_task_generators.EquationTaskGenerator;
import by.Savenok.quizer.task_generators.math_task_generators.ExpressionTaskGenerator;
import by.Savenok.quizer.task_generators.TextTaskGenerator;

import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;


public class Main {
static Map<String, Quiz> getQuizMap() throws FileNotFoundException {
Map<String, Quiz> generators = new HashMap<>();
generators.put("Expression mode (5 tasks)",
new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 5));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Консанты лучше в отдельный файлик.

generators.put("Expression mode (10 tasks)",
new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 10));
generators.put("Expression mode (15 tasks)",
new Quiz(new ExpressionTaskGenerator(0, 100, true, true, true, true), 15));
generators.put("Equation mode (5 tasks)",
new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 5));
generators.put("Equation mode (10 tasks)",
new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 10));
generators.put("Equation mode (15 tasks)",
new Quiz(new EquationTaskGenerator(0, 100, true, true, true, true), 15));
generators.put("Text mode (3 tasks)",
new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.HARD), 3));
generators.put("Text mode (2 tasks)",
new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.NIGHTMARE), 2));
return generators;
}
public static void main(String[] args) throws FileNotFoundException {
System.out.print("Want to create your mode or chose an existing one? (YES/NO)");
Scanner in = new Scanner(System.in);
if (Objects.equals(in.nextLine(), "YES")) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут это не совсемм уместно, так как приложение тестит тебя, а не ты создаешь тесты. Но так как этого никто не просил, а ты сделал, то немного накину.

System.out.println("Choose task mode:");
System.out.println("Expression / Equation / Text");
String custom_mode = in.nextLine();
System.out.println("Enter task count:");
String custom_task_count = in.nextLine();
if (Objects.equals(custom_mode, "Text")) {
System.out.println("Enter difficulty level:");
System.out.println("Hard / Nightmare");
String custom_level = in.nextLine();
if (Objects.equals(custom_level, "Hard")) {
Quiz quiz = new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.HARD),
Integer.parseInt(custom_task_count));
quiz.StartQuiz();
} else {
new Quiz(new TextTaskGenerator(TextTaskGenerator.DifficultyLevel.NIGHTMARE),
Integer.parseInt(custom_task_count)).StartQuiz();
return;
}
} else {
System.out.println("Enable sum tasks?");
System.out.println("Yes / No");
String blank = in.nextLine();
boolean sum = false;
if (Objects.equals(blank, "Yes")) {
sum = true;
}
System.out.println("Enable difference tasks?");
System.out.println("Yes / No");
blank = in.nextLine();
boolean dif = false;
if (Objects.equals(blank, "Yes")) {
dif = true;
}
System.out.println("Enable multiply tasks?");
System.out.println("Yes / No");
blank = in.nextLine();
boolean mul = false;
if (Objects.equals(blank, "Yes")) {
mul = true;
}
System.out.println("Enable sum tasks?");
System.out.println("Yes / No");
blank = in.nextLine();
boolean div = false;
if (Objects.equals(blank, "Yes")) {
div = true;
}
System.out.println("Enter max number");
int max = Integer.parseInt(in.nextLine());
System.out.println("Enter min number");
int min = Integer.parseInt(in.nextLine());

if (Objects.equals(custom_mode, "Expression")) {
new Quiz(new ExpressionTaskGenerator(min, max, sum,dif, mul, div),
Integer.parseInt(custom_task_count)).StartQuiz();
return;
}
if (Objects.equals(custom_mode, "Equation")) {
new Quiz(new EquationTaskGenerator(min, max, sum,dif, mul, div),
Integer.parseInt(custom_task_count)).StartQuiz();
return;
}
}

}
System.out.println("Choose task mode (Expression / Equation / Text):");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще не интуитивно понятно, я пока в код не залез ничего не смог запустить((

Map<String, Quiz> generators = getQuizMap();
for (Map.Entry<String, Quiz> it : generators.entrySet())
{
System.out.println(it.getKey());
}
String mode = in.nextLine();
System.out.println("Choose tasks count:");
String count = in.nextLine();
generators.get(mode + " mode " + "(" + count + " tasks)").StartQuiz();
in.close();
}
}
Loading