Skip to content

Commit

Permalink
Merge pull request #332 from Zackermax/331-accept-uppercase-commands-…
Browse files Browse the repository at this point in the history
…in-parser

Parser accepts uppercase inputs
  • Loading branch information
TheDinos authored Nov 11, 2024
2 parents 2687501 + ce05b52 commit 04dfc5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/fittrack/FitTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public static void main(String[] args) throws IOException {
return;
}
String[] userInfo = parseUserInfo(userInput);
validUser(userInfo[0], userInfo[1]);
user = new User(userInfo[0], userInfo[1]);
validUser(userInfo[0].toLowerCase(), userInfo[1]);
user = new User(userInfo[0].toLowerCase(), userInfo[1]);
printUser(user.getAge(), user.getGender().toString().toLowerCase());
updateSaveFile(user, sessionList, goalList, reminderList, foodWaterList);
} catch (Exception e) {
Expand All @@ -100,7 +100,7 @@ public static void main(String[] args) throws IOException {
String input = scan.nextLine();

// Until the exit command is entered, execute command then read user input
while (!input.trim().equals(EXIT_COMMAND)) {
while (!input.toLowerCase().trim().equals(EXIT_COMMAND)) {
Parser.parse(user, input, sessionList, reminderList, goalList, foodWaterList);
input = scan.nextLine();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fittrack/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public static void parse(User user, String input, ArrayList<TrainingSession> ses
}

// Switch-case structure to handle each command type
switch (command) {
switch (command.toLowerCase()) {
case HELP_COMMAND:
printHelp();
break;
Expand Down

0 comments on commit 04dfc5b

Please sign in to comment.