Skip to content
Open
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions src/main/java/com/houarizegai/calculator/ui/CalculatorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ public CalculatorUI() {
window.setVisible(true);
}

/**
* Performs a mathematical operation on two numbers based on the given operator.
*
* @param firstNumber The first operand for the mathematical operation.
* @param secondNumber The second operand for the mathematical operation.
* @param operator The operator specifying the type of mathematical operation to be performed.
* Valid operators are '+', '-', '*', '/', '%', '^'.
* @return The result of the mathematical operation.
*/
public double calculate(double firstNumber, double secondNumber, char operator) {
switch (operator) {
case '+':
Expand Down