forked from AY2324S1-CS2103T-T13-0/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
196 additions
and
121 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/seedu/address/logic/commands/CalculateCAPCommand.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
|
||
/** | ||
* Deletes a person identified using it's displayed index from the address book. | ||
*/ | ||
public class CalculateCAPCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "calculate CAP"; | ||
public static final String MESSAGE_CALCULATION_SUCCESS = "Calculated value: %1$s"; | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
int modularCredits = model.totalModularCredits(); | ||
|
||
Float gradePointsByUnits = model.totalGradePointsByUnits(); | ||
|
||
Float calculatedCAPValue = gradePointsByUnits / modularCredits; | ||
|
||
return new CommandResult(String.format(MESSAGE_CALCULATION_SUCCESS, calculatedCAPValue)); | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
src/main/java/seedu/address/logic/commands/CalculateCommand.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
src/main/java/seedu/address/logic/commands/CalculateMCCommand.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
|
||
public class CalculateMCCommand extends Command { | ||
public static final String COMMAND_WORD = "calculate MC"; | ||
public static final String MESSAGE_CALCULATION_SUCCESS = "Calculated value: %1$s"; | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
int modularCredits = model.totalModularCredits(); | ||
|
||
return new CommandResult(String.format(MESSAGE_CALCULATION_SUCCESS, modularCredits)); | ||
} | ||
} |
This file contains 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
30 changes: 0 additions & 30 deletions
30
src/main/java/seedu/address/logic/parser/CalculateCommandParser.java
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/main/java/seedu/address/model/function/ModularCredits.java
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
27 changes: 27 additions & 0 deletions
27
src/test/java/seedu/address/logic/commands/CalculateCAPCommandTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure; | ||
import static seedu.address.testutil.TypicalModules.getTypicalAddressBook; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.model.Model; | ||
import seedu.address.model.ModelManager; | ||
import seedu.address.model.UserPrefs; | ||
import seedu.address.testutil.TypicalModules; | ||
|
||
/** | ||
* Contains integration tests (interaction with the Model) and unit tests for CalculateCAPCommand. | ||
*/ | ||
public class CalculateCAPCommandTest { | ||
|
||
private Model model; | ||
private Model expectedModel; | ||
@BeforeEach | ||
public void setUp() { | ||
model = new ModelManager(TypicalModules.getTypicalAddressBook(), new UserPrefs()); | ||
expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs()); | ||
} | ||
|
||
} |
27 changes: 0 additions & 27 deletions
27
src/test/java/seedu/address/logic/commands/CalculateCommandTest.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/test/java/seedu/address/logic/commands/CalculateMCCommandTest.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static seedu.address.logic.commands.CommandTestUtil.assertCommandFailure; | ||
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import seedu.address.model.Model; | ||
import seedu.address.model.ModelManager; | ||
import seedu.address.model.UserPrefs; | ||
import seedu.address.testutil.TypicalModules; | ||
|
||
/** | ||
* Contains integration tests (interaction with the Model) and unit tests for CalculateMCCommand. | ||
*/ | ||
public class CalculateMCCommandTest { | ||
private Model model; | ||
private Model expectedModel; | ||
@BeforeEach | ||
public void setUp() { | ||
model = new ModelManager(TypicalModules.getTypicalAddressBook(), new UserPrefs()); | ||
expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs()); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.