Lab1#43
Open
alexbiliba wants to merge 1 commit into
Open
Conversation
Rrenkens
reviewed
Dec 21, 2022
| ArrayList<Task> tasks = new ArrayList<>(); | ||
| int current_task_index = -1; | ||
|
|
||
| int AC_number = 0; |
Owner
There was a problem hiding this comment.
Для этого предоставляют геттеры и сеттеры и делют их приватными.
| * @param taskCount количество заданий в тесте | ||
| */ | ||
| Quiz(Task.Generator generator, int taskCount) { | ||
| while (taskCount > 0) { |
Owner
There was a problem hiding this comment.
Почему нельзя делать это лениво?
| } else if (current_result == Result.WRONG) { | ||
| WA_number++; | ||
| } else { | ||
| II_number++; |
Owner
There was a problem hiding this comment.
Вряд ли тут соблюдается контракт выше.
| @@ -0,0 +1,47 @@ | |||
| package by.alexbiliba.quizer.task_generators; | |||
|
|
|||
| import by.alexbiliba.quizer.*; | |||
| * Если этот генератор выбросил исключение в методе generate(), выбирается другой. | ||
| * Если все генераторы выбрасывают исключение, то и тут выбрасывается исключение. | ||
| */ | ||
| public Task generate() { |
| if (answerPosition == 0) { | ||
| leftNumber = resultNumber / rightNumber; | ||
| } else if (answerPosition == 1) { | ||
| rightNumber = resultNumber / leftNumber; |
Owner
There was a problem hiding this comment.
В коде выше могло получиться, что leftNumber = 0.
| if (answerPosition == 0) { | ||
| leftNumber = resultNumber * rightNumber; | ||
| } else if (answerPosition == 1) { | ||
| rightNumber = leftNumber / resultNumber; |
Owner
There was a problem hiding this comment.
Тут тоже могло получиться, что resultNumber = 0
| } else if (operation == MathTask.Operation.DIFFERENCE) { | ||
| leftNumber = resultNumber + rightNumber; | ||
| if (answerPosition == 0) { | ||
| leftNumber = resultNumber + rightNumber; |
Owner
There was a problem hiding this comment.
Тут нарушается инвариант про диапазон значений.
| } | ||
| } | ||
|
|
||
| return new AbstractMathTask(leftNumber, rightNumber, resultNumber, operation, precision, 2); |
| text = ""; | ||
| if (answerPosition == 0) { | ||
| text += 'x'; | ||
| answer = BigDecimal.valueOf(leftNumber) |
Owner
There was a problem hiding this comment.
Можно вот это было куда-то вынести 5 раз одно и то же.
Owner
|
Ну пока что такая оценка:
Допы:
В итоге 4.35, коэффициент 0.5 = 2.275. +4 за допы. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Я не сделал изначально форк и из-за этого слетели все коммиты.