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

[LIU SIYI] iP #184

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open

[LIU SIYI] iP #184

wants to merge 56 commits into from

Conversation

64-1
Copy link

@64-1 64-1 commented Feb 7, 2024

No description provided.

Copy link

@JingHaoooo JingHaoooo left a comment

Choose a reason for hiding this comment

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

Overall it looks good. Although there were some minor coding standard violations.

Comment on lines 69 to 83
switch (input) {
case "1":
gender = "Male";
break;
case "2":
gender = "Female";
break;
case "3":
gender = "Other";
break;
default:
System.out.println("Invalid option selected. Please enter 1, 2, or 3.");
continue;
}
break; // Exit the loop once a valid input is received.

Choose a reason for hiding this comment

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

There should not be any indentation for case clauses to follow the coding standards.

Comment on lines 11 to 16
String message = String.format(
"Verification passed.\nOptions enabled.\n%s Born on %s\n%s\nID A.D.0013\n" +
"Rank 'S'\nListed in the Kassel Academy roster.\n" +
"Database access granted\nAccount activated\nCourse schedule generated\n" +
"I am Erii, the secretary of Kassel Academy, pleased to serve you.",
name, birthday, gender);

Choose a reason for hiding this comment

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

I like the line wrapping. It makes it more readable.

@@ -0,0 +1,39 @@
// TaskManager.java
public class TaskManager {
private static final String[] tasks = new String[100];

Choose a reason for hiding this comment

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

Can consider setting 100 to a constant variable.

public static void addTask(String task) {
if (taskCount < tasks.length) {
tasks[taskCount++] = task;
System.out.println("____________________________________________________________");

Choose a reason for hiding this comment

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

Can consider changing divider to a constant.

*
* @return the user's full name
*/
public static String getName() {

Choose a reason for hiding this comment

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

Naming of variables are good as it follows the naming conventions of using camelCase.

Comment on lines 25 to 37
public static boolean processCommand(String command) {
if ("list".equalsIgnoreCase(command)) {
listTasks();
return true;
} else if ("bye".equalsIgnoreCase(command)) {
System.out.println("____________________________________________________________");
System.out.println(" Bye. Hope to see you again soon!");
System.out.println("____________________________________________________________");
return false;
} else {
addTask(command);
return true;
}
Copy link

Choose a reason for hiding this comment

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

Good indentation

Comment on lines 69 to 81
switch (input) {
case "1":
gender = "Male";
break;
case "2":
gender = "Female";
break;
case "3":
gender = "Other";
break;
default:
System.out.println("Invalid option selected. Please enter 1, 2, or 3.");
continue;
Copy link

@CXIA17 CXIA17 Feb 8, 2024

Choose a reason for hiding this comment

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

case and switch should be aligned, invalid indentation

Copy link

@hafizuddin-a hafizuddin-a left a comment

Choose a reason for hiding this comment

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

good code quality

@@ -0,0 +1,27 @@
public class Erii {
public static void main(String[] args) {
String art =

Choose a reason for hiding this comment

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

perhaps move this to another file?

@@ -0,0 +1,88 @@
import java.util.Scanner;
import java.util.regex.Matcher;

Choose a reason for hiding this comment

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

i like that you use regex

System.out.println("Please enter your full name (First Name Last Name): ");
String name;
while (true) {
name = scanner.nextLine().trim();

Choose a reason for hiding this comment

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

good using trim to remove unnecessary characters

}

public static boolean processCommand(String command) {
if ("list".equalsIgnoreCase(command)) {

Choose a reason for hiding this comment

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

good that you have a method to ignore case

@@ -0,0 +1,27 @@
public class Erii {
public static void main(String[] args) {
String art =
Copy link

Choose a reason for hiding this comment

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

Make variable names for constant all uppercase.

Comment on lines 1 to 2
import java.util.Scanner;
import java.util.regex.Matcher;
Copy link

Choose a reason for hiding this comment

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

Import classes listed explicitly, good

Copy link

@sevenseasofbri sevenseasofbri left a comment

Choose a reason for hiding this comment

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

Good job, you can improve upon abstraction of the code. Else, well done. 👍🏽

Comment on lines 5 to 22
// Prompt the user to enter their details
String name = UserDetails.getName();
String birthday = UserDetails.getBirthday();
String gender = UserDetails.getGenderSelection();


// Print the user details with a welcome message
String message = String.format(
"Verification passed.\nOptions enabled.\n%s Born on %s\n%s\nID A.D.0013\n" +
"Rank 'S'\nListed in the Kassel Academy roster.\n" +
"Database access granted\nAccount activated\nCourse schedule generated\n" +
"I am Erii, the secretary of Kassel Academy, pleased to serve you.",
name, birthday, gender);

System.out.println(message);

//Call control panel to start the task manager
ControlPanel.main(args);

Choose a reason for hiding this comment

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

These comments are not required as it is quite clear from the code already.


public class Erii {
public static void main(String[] args) {
String art =

Choose a reason for hiding this comment

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

consider storing this art as a static final variable


public class TaskManager {

public enum Priority {

Choose a reason for hiding this comment

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

good use of enum

SS, S, A, B, C, D
}

public abstract class Task {

Choose a reason for hiding this comment

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

avoid declaring multiple classes within a same file, try an separate them into differen files (to improve readability)

System.out.println("Got it. I've added this task:");
System.out.println(" " + task);
System.out.println("Now you have " + tasks.size() + " tasks in the list.");
System.out.println("____________________________________________________________");

Choose a reason for hiding this comment

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

you can store is line as a static final variable instead

private static void addDeadlineTask(String input, TaskManager taskManager) {
String[] parts = input.split(" ?/by | ?/ ?");
if(parts.length < 3 || parts[1].isEmpty() || parts[2].isEmpty()){
System.out.println("Incorrect format. Please ensure the task description is followed by '/by' and a deadline date, and then a priority value (e.g., 'submit report /by 2021-09-30 /SS').");

Choose a reason for hiding this comment

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

similarly here, split into 2 lines to avoid exceeding the line character limit.

}
}

private static String getAddress() {

Choose a reason for hiding this comment

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

the name of this function is a little misleading perhaps? I understand it probably refers to how to 'address' someone, but maybe use a word like salutation or userTitle instead?

Comment on lines 12 to 13
private static final Scanner scanner = new Scanner(System.in);
private static final Pattern datePattern = Pattern.compile("^\\d{2}/\\d{2}/\\d{4}$");

Choose a reason for hiding this comment

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

Constant names must be all uppercase using underscore to separate words (aka SCREAMING_SNAKE_CASE).

https://se-education.org/guides/conventions/java/basic.html#naming

Comment on lines 14 to 16
private static String UserName = "";
private static String UserBirthday = "";
private static String UserGender = "";

Choose a reason for hiding this comment

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


public class ControlPanel {

public static void main(String[] args) {

Choose a reason for hiding this comment

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

this method is really long (>30 LOC) shorten it by abstracting out parts of code into functions

https://nus-cs2113-ay2324s2.github.io/website/se-book-adapted/chapters/codeQuality.html#avoid-long-methods

64-1 and others added 30 commits February 25, 2024 17:53
Enhance event and deadline date handling with time support
Implement task search by keyword
This reverts commit 007e4ab.
(cherry picked from commit 007e4ab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants