Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Haris-Irfan] iP #618

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
68c58c1
Add Gradle support
May 24, 2020
03523ec
Bump gradle and lib version
Eclipse-Dominator Aug 5, 2023
81a9c53
build.gradle: Prevent generating a second JAR file
aureliony Jul 16, 2024
2063dca
Implement basic skeleton of chatbot
Haris-Irfan Aug 27, 2024
6b9dc47
Implement switch statement and scanner in main
Haris-Irfan Aug 27, 2024
b0d0248
Rename project from Duke to KieTwoForOne
Haris-Irfan Aug 27, 2024
ba04115
Implement adding and listing of tasks functionality
Haris-Irfan Aug 27, 2024
ec3a264
Implement Task class
Haris-Irfan Aug 27, 2024
d2db81a
Implement mark and unmark functionality
Haris-Irfan Aug 27, 2024
5a50742
Implement event, todo, and deadline functionality
Haris-Irfan Aug 28, 2024
4ddf73a
Implement automated Text UI testing
Haris-Irfan Aug 28, 2024
9d6ea60
Implement exceptions
Haris-Irfan Aug 29, 2024
6c4874b
Convert Task[] array to ArrayList<Task>
Haris-Irfan Aug 29, 2024
c5052c3
Implement deletion functionality
Haris-Irfan Aug 29, 2024
fbe0696
Update automated Text UI testing
Haris-Irfan Aug 29, 2024
9017cbf
Implement saving functionality
Haris-Irfan Sep 5, 2024
6000982
Merge branch 'branch-level-7'
Haris-Irfan Sep 5, 2024
25cbb40
Implement date time reading and filtering functionality
Haris-Irfan Sep 5, 2024
83284e2
Merge branch 'branch-level-8'
Haris-Irfan Sep 5, 2024
210ce03
Implement more OOP
Haris-Irfan Sep 6, 2024
be5e203
Merge branch 'A-MoreOOP'
Haris-Irfan Sep 6, 2024
9c2fab2
Implement packages
Haris-Irfan Sep 6, 2024
8676b51
Merge branch 'A-Packages'
Haris-Irfan Sep 6, 2024
f3e91ac
Merge branch 'A-Gradle'
Haris-Irfan Sep 6, 2024
334e5ba
Implement main package kietwoforone to put all classes in
Haris-Irfan Sep 6, 2024
4de9757
Modify build.gradle from duke to KieTwoForOne
Haris-Irfan Sep 6, 2024
c95e66d
Implement JUnit testing
Haris-Irfan Sep 10, 2024
61de17d
Merge branch 'A-JUnit'
Haris-Irfan Sep 10, 2024
6665b95
Configue build.gradle to create JAR file
Haris-Irfan Sep 10, 2024
32c53e3
Merge branch 'A-Jar'
Haris-Irfan Sep 10, 2024
10f4954
Implement filter by word functionality
Haris-Irfan Sep 10, 2024
80081a1
Merge branch 'Level-9'
Haris-Irfan Sep 10, 2024
287a95e
Implement Java documentation
Haris-Irfan Sep 11, 2024
e96ae01
Merge branch 'A-JavaDoc'
Haris-Irfan Sep 11, 2024
6b0be98
Add one line space between showSameDate and showMatchingTask methods
Haris-Irfan Sep 11, 2024
2aa1b6d
Edit code in line with coding standards
Haris-Irfan Sep 12, 2024
1140ada
Merge branch 'A-CodingStandard'
Haris-Irfan Sep 12, 2024
2fcd098
Fix issue: missing FIND case in switch statement
Haris-Irfan Sep 12, 2024
eacfb9f
Separate logic statements in the parse method
Haris-Irfan Sep 12, 2024
e92ac18
Configure build.gradle to support checkstyle usage
Haris-Irfan Sep 12, 2024
7b8243b
Merge branch 'A-CheckStyle'
Haris-Irfan Sep 12, 2024
70ce235
Implement GUI
Haris-Irfan Sep 12, 2024
e7a3da0
Merge branch 'Level-10'
Haris-Irfan Sep 12, 2024
f32a11f
Update README.md
Haris-Irfan Sep 12, 2024
1062188
Update README.md
Haris-Irfan Sep 12, 2024
8ae70b7
Update README.md
Haris-Irfan Sep 12, 2024
e84194a
Update README.md
Haris-Irfan Sep 12, 2024
d42180b
Update README.md
Haris-Irfan Sep 12, 2024
ff32694
Update README.md
Haris-Irfan Sep 12, 2024
4589e51
Update README.md
Haris-Irfan Sep 12, 2024
ff73301
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan Sep 12, 2024
aa8c95d
Implement chatbot closing functionality
Haris-Irfan Sep 17, 2024
9609f22
Implement assertions
Haris-Irfan Sep 18, 2024
4907902
Improve code quality
Haris-Irfan Sep 19, 2024
f71046a
Merge pull request #2 from Haris-Irfan/branch-A-Assertions
Haris-Irfan Sep 19, 2024
298bc46
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan Sep 19, 2024
3657837
Merge branch 'master' into branch-A-CodeQuality
Haris-Irfan Sep 19, 2024
22fcc86
Merge pull request #3 from Haris-Irfan/branch-A-CodeQuality
Haris-Irfan Sep 19, 2024
4c99dea
Merge branch 'master' of https://github.com/Haris-Irfan/ip
Haris-Irfan Sep 19, 2024
b326900
Implement tagging functionality
Haris-Irfan Sep 19, 2024
27d469e
Merge branch 'branch-C-Tagging'
Haris-Irfan Sep 19, 2024
652fe01
Finalize features.
Haris-Irfan Sep 20, 2024
3468419
Added file path creation functionality in the Storage class.
Haris-Irfan Sep 20, 2024
aa99a00
Update README.md
Haris-Irfan Sep 20, 2024
f729335
Include information on bye command to exit the application
Haris-Irfan Sep 20, 2024
bf6ba66
Update Ui.png
Haris-Irfan Sep 20, 2024
a63ad8f
Clean up syntax in README.md
Haris-Irfan Sep 20, 2024
7b8e920
Fix tagging functionality
Haris-Irfan Sep 20, 2024
bc8a2d4
Fixed JavaDoc Comments.
Haris-Irfan Sep 23, 2024
74446b5
Update README.md
Haris-Irfan Sep 28, 2024
fed83dd
Update README.md
Haris-Irfan Sep 28, 2024
853d82c
Update README.md
Haris-Irfan Sep 28, 2024
d538e9c
Update README.md
Haris-Irfan Sep 28, 2024
88b7389
Update README.md
Haris-Irfan Sep 28, 2024
ca1515e
Update README.md
Haris-Irfan Sep 28, 2024
675cb81
Update README.md
Haris-Irfan Sep 28, 2024
2fd90d8
Update README.md
Haris-Irfan Sep 28, 2024
616d902
Update README.md
Haris-Irfan Sep 28, 2024
fb37bce
Update README.md
Haris-Irfan Sep 28, 2024
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
53 changes: 41 additions & 12 deletions src/main/java/KieTwoForOne.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,44 @@

public class KieTwoForOne {

private static String[] tasks = new String[100];
private static Task[] tasks = new Task[100];
private static int count = 0;
static String separationLine = "_________________________________________";
static String chatBotName = "KieTwoForOne";

public static void addTasks(String task) {
tasks[count] = task;
public enum Instructions {

Choose a reason for hiding this comment

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

I like how you use enum to represent all the instructions.

LIST, BLAH, MARK, UNMARK, BYE, READ, FIND
}
public static void addTasks(Task newtask) {
tasks[count] = newtask;
count++;
System.out.println(String.format("added: %s", task));
System.out.println(String.format("added: %s", newtask.toString()));
System.out.println(separationLine);
}

public static void listTasks() {
for (int i = 0; tasks[i] != null; i++) {
System.out.println(String.format("%d. %s", i + 1, tasks[i]));
System.out.println(String.format("%d. %s", i + 1, tasks[i].toString()));
}
System.out.println(separationLine);
}

public static void markTask(int position) {
Task markedTask = tasks[position - 1];
markedTask.setTrue();
System.out.println("Nice! I've marked this task as done:");
System.out.println(markedTask);
System.out.println(separationLine);
}

public static void unmarkTask(int position) {
Task unmarkedTask = tasks[position - 1];
unmarkedTask.setFalse();
System.out.println("Ok. I've marked this task as not done yet:");
System.out.println(unmarkedTask);
System.out.println(separationLine);
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

Expand All @@ -30,24 +49,34 @@ public static void main(String[] args) {
System.out.println(separationLine);

while(true) {
String instruction = scanner.nextLine();
switch (instruction.toUpperCase()) {
case "LIST":
String input = scanner.nextLine().toUpperCase();
String[] instruction = input.split(" ", 2);

switch (Instructions.valueOf(instruction[0])) {

Choose a reason for hiding this comment

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

Shouldn't there be no indentation for case clauses?

case LIST:
KieTwoForOne.listTasks();
break;
case "BYE":
case BYE:
System.out.println("Bye. Hope to see you again soon!");
System.out.println(separationLine);
break;
case "BLAH":
case BLAH:
System.out.println("blah");
System.out.println(separationLine);
break;
case MARK:
KieTwoForOne.markTask(Integer.valueOf(instruction[1]));
break;
case UNMARK:
KieTwoForOne.unmarkTask(Integer.valueOf(instruction[1]));
break;
case READ, FIND:
KieTwoForOne.addTasks(new Task(String.format("%s %s", instruction[0], instruction[1])));
break;
default:
KieTwoForOne.addTasks(instruction);
break;
}
if (instruction.equalsIgnoreCase("bye")) {
if (instruction[0].equalsIgnoreCase("bye")) {
break;
}
}
Expand Down