This repository contains simple calculator programs written in Java. The calculators can perform basic arithmetic operations such as addition, subtraction, multiplication, and division. The current implementations use else if
statements and switch
cases to handle different arithmetic modes. More features and modes may be added in the future.
- Addition: Adds two numbers.
- Subtraction: Subtracts the second number from the first number.
- Multiplication: Multiplies two numbers.
- Division: Divides the first number by the second number. Includes a check to prevent division by zero.
-
Switch Calculator (
switch_calculator.java
): Uses aswitch
statement to handle the selection of arithmetic operations. -
Else If Calculator (
Calculator_ElseIf.java
): Useselse if
statements to handle the selection of arithmetic operations. -
Ternary Calculator (
TernaryCalculator.java
): Uses a nestedternary operator
to perform arithmetic operations in a compact, single-line expression. -
Function Calculator (
Function_Calculator.java
): Usesfunctions
to handle the selection of arithmetic operations. -
Birthday Calculator (
Whats_my_birthday.java
): Calculates a person's age and the number of days until their next birthday based on their birth date and the current date.
git clone https://github.com/your-username/java-calculator-collection.git
cd java-calculator-collection
javac switch_calculator.java
javac Calculator_ElseIf.java
javac Calculator_Mini.java
javac Function_Calculator.java
javac Whats_my_birthday.java
java switch_calculator
java Calculator_ElseIf
java Calculator_Mini
java Function_Calculator
java Whats_my_birthday
Contributions are welcome! Please fork this repository and submit a pull request for any features or bug fixes you would like to add.