From dd074b71b6b8f21b91c592b94bb85a5cab09aeec Mon Sep 17 00:00:00 2001 From: yzhanglp Date: Wed, 10 Apr 2024 13:45:02 +0800 Subject: [PATCH 1/3] add the explanation --- src/main/java/seedu/duke/Checker.java | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/main/java/seedu/duke/Checker.java b/src/main/java/seedu/duke/Checker.java index 67d83e2972..dda08d20b1 100644 --- a/src/main/java/seedu/duke/Checker.java +++ b/src/main/java/seedu/duke/Checker.java @@ -91,4 +91,42 @@ public double getAccuracy() { public long getTime() { return time; } + + public String getExplaination(Problem problem){ + String description = problem.getDescription(); + String explanation = ""; + explanation = "Let's explain this problem by the following format: +/n"; + String startSpace = "\t\t\t"; + if(description.contains("+")){ + String [] parser = description.split("\\+"); + double firstNumber = Double.parseDouble(parser[0]); + double secondNubmber = Double.parseDouble(parser[1]); + String firstString = String.valueOf(firstNumber); + String secondString = String.valueOf(secondNubmber); + //Shift the longer number to the first + if(firstString.length() Date: Wed, 10 Apr 2024 16:19:56 +0800 Subject: [PATCH 2/3] add the simple explanation --- recordList.txt | 10 ++++ src/main/java/seedu/duke/Checker.java | 78 +++++++++++++++++++-------- src/main/java/seedu/duke/Parser.java | 5 ++ 3 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 recordList.txt diff --git a/recordList.txt b/recordList.txt new file mode 100644 index 0000000000..b1316af745 --- /dev/null +++ b/recordList.txt @@ -0,0 +1,10 @@ +2024-04-10 15:14:24 0.05917159763313609 0.2 1131087689 83/9,9.222222222222221 18+0,18.0 16-16,0.0 68/4,17.0 4+61,65.0 30/8,3.75 78+53,131.0 92-22,70.0 51/7,7.285714285714286 28/7,4.0 +2024-04-10 15:17:12 0.23255813953488372 0.0 -2045770529 6/4,1.5 68-46,22.0 35/1,35.0 71*76,5396.0 48+6,54.0 23/9,2.5555555555555554 60*98,5880.0 85*10,850.0 88*6,528.0 89+37,126.0 +2024-04-10 15:17:28 0.6666666666666666 0.0 1314322124 51-6,45.0 68*42,2856.0 78+55,133.0 97-41,56.0 89-68,21.0 50/7,7.142857142857143 19*64,1216.0 31*57,1767.0 34*75,2550.0 4*71,284.0 +2024-04-10 15:19:18 0.11494252873563218 0.0 308676570 6-12,-6.0 44-56,-12.0 68-98,-30.0 73-60,13.0 13-86,-73.0 36-14,22.0 81+13,94.0 74+46,120.0 51*82,4182.0 90-61,29.0 +2024-04-10 15:20:47 0.14925373134328357 0.0 -2045770529 43-85,-42.0 86/7,12.285714285714286 67-9,58.0 46*21,966.0 98-69,29.0 72/5,14.4 16*41,656.0 34/3,11.333333333333334 7/9,0.7777777777777778 67+30,97.0 +2024-04-10 15:23:41 0.06289308176100629 0.0 -2045770529 91-67,24.0 64+45,109.0 79-50,29.0 50*86,4300.0 85*50,4250.0 31/5,6.2 70*11,770.0 41/9,4.555555555555555 16-47,-31.0 69+88,157.0 +2024-04-10 15:34:58 0.01524390243902439 0.0 -585014801 49+52,101.0 37+62,99.0 16+32,48.0 58+58,116.0 82-61,21.0 13+16,29.0 46/7,6.571428571428571 35*27,945.0 64+83,147.0 88/4,22.0 +2024-04-10 15:37:53 0.11764705882352941 0.0 854452107 75-65,10.0 17/4,4.25 3/4,0.75 57/8,7.125 84*38,3192.0 79*92,7268.0 45+21,66.0 45*5,225.0 61-89,-28.0 62+68,130.0 +2024-04-10 16:08:33 0.29411764705882354 0.4 1784552838 36+17,53.0 19+13,32.0 49/2,24.5 28+16,44.0 76+32,108.0 25*22,550.0 34+42,76.0 28-94,-66.0 0-72,-72.0 96/7,13.714285714285714 +2024-04-10 16:19:08 0.20833333333333334 0.3 1784552838 53/6,8.833333333333334 1-71,-70.0 78-57,21.0 75-54,21.0 15/2,7.5 6+59,65.0 57+81,138.0 56+2,58.0 7-49,-42.0 33+87,120.0 diff --git a/src/main/java/seedu/duke/Checker.java b/src/main/java/seedu/duke/Checker.java index dda08d20b1..1830b3d3f6 100644 --- a/src/main/java/seedu/duke/Checker.java +++ b/src/main/java/seedu/duke/Checker.java @@ -4,15 +4,15 @@ import java.util.List; public class Checker { - private String[] userAnswer; + private final String[] userAnswer; private final Test test; - private Boolean[] isCorrect; + private final Boolean[] isCorrect; private int correctNumber; private double accuracy; private long time; private final List wrongProblem = new ArrayList<>(); - private List wrongAnswer = new ArrayList<>(); - private Ui ui = new Ui(""); + private final List wrongAnswer = new ArrayList<>(); + private final Ui ui = new Ui(""); public Checker(Test test) { assert test != null : "Input null test!"; @@ -59,6 +59,7 @@ void getUserAnswer() { // hand with time and acc long endTime = System.currentTimeMillis(); accuracy = (double) correctNumber / test.getNumber(); + //millisecond to second this.time = (endTime - startTime) / 1000; for (int i = 0; i < test.getNumber(); i++) { if (isCorrect[i] = false) { @@ -92,41 +93,76 @@ public long getTime() { return time; } - public String getExplaination(Problem problem){ + public static String getExplanation(Problem problem){ String description = problem.getDescription(); - String explanation = ""; - explanation = "Let's explain this problem by the following format: +/n"; - String startSpace = "\t\t\t"; + String start = "Let's explain this problem by the following format: "+"\n\n"; + List explanation = new ArrayList<>(); + StringBuilder builder = new StringBuilder(); if(description.contains("+")){ String [] parser = description.split("\\+"); double firstNumber = Double.parseDouble(parser[0]); - double secondNubmber = Double.parseDouble(parser[1]); + double secondNumber = Double.parseDouble(parser[1]); + String answerString = String.valueOf(problem.getAnswer()); String firstString = String.valueOf(firstNumber); - String secondString = String.valueOf(secondNubmber); + String secondString = String.valueOf(secondNumber); //Shift the longer number to the first if(firstString.length() Date: Thu, 11 Apr 2024 22:18:40 +0800 Subject: [PATCH 3/3] add the ppp and some parts of explanation generator --- docs/team/yzhanglp.md | 13 +++++++++++++ src/main/java/seedu/duke/Parser.java | 9 +++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 docs/team/yzhanglp.md diff --git a/docs/team/yzhanglp.md b/docs/team/yzhanglp.md new file mode 100644 index 0000000000..3804235b14 --- /dev/null +++ b/docs/team/yzhanglp.md @@ -0,0 +1,13 @@ +# Yuhao ZHANG + +## Overview of `MathGenius` +**`MathGenius`** is a user-friendly application that provides a platform to enhance your equation-solving abilities. Whether you're a student learning calculation, a math enthusiast looking to sharpen your skills, or a teacher preparing for exams/lessons, this application is here to support you. + +## Summary of Contribution +[**link to the code**](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=yzhanglp&breakdown=true) +In the project `MathGenius`, I am in conduct of implement the `checker` part, which is use to check the user's answer, record the time and accuracy, as well as generate the explanation of the questions. +In the `UserGuide`,I am in conduct of writing the introduction and some parts of the guidance. +In the `Development Guide`, I am in conduct of writing the `checker` part as well as draft the DG and draw the UML sequence model. +Of the team based tasks, I am in conduct of setting up the `github repo` and `github team`, release management and conduct meeting. +Basicly, all of us review our PR together, so we all share equal contribution in reviewing PRs. I have helped one of my teammates in setting up the ssh connection of github to make sure she can push the code to the origin. +For other contribution, I am in conduct of arrange the team meeting and gathering to help us stay togther in working out the problems we may meet. \ No newline at end of file diff --git a/src/main/java/seedu/duke/Parser.java b/src/main/java/seedu/duke/Parser.java index e02921872c..faabc0cbdf 100644 --- a/src/main/java/seedu/duke/Parser.java +++ b/src/main/java/seedu/duke/Parser.java @@ -81,10 +81,11 @@ public static void solveProbSet(Test test, Ui ui, boolean retry, int id) { Problem problem = wrongProblem.get(i); ui.print("Your answer: " + problem.getDescription() + " = " + wrongAnswer.get(i)); ui.print("Correct Answer: " + problem.solved()); - ui.print("If you want to see the explanation, type exp or explanation, else just type enter"); - String userInput = ui.readCommand(); - if(userInput.equals("exp")||userInput.equals("explanation")) - System.out.println(Checker.getExplanation(problem)); + // need further implementation for 3 more operators + // ui.print("If you want to see the explanation, type exp or explanation, else just type enter"); + // String userInput = ui.readCommand(); + // if(userInput.equals("exp")||userInput.equals("explanation")) + // System.out.println(Checker.getExplanation(problem)); } // Storage write to file