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 aswitchstatement to handle the selection of arithmetic operations. -
Else If Calculator (
Calculator_ElseIf.java): Useselse ifstatements to handle the selection of arithmetic operations. -
Ternary Calculator (
TernaryCalculator.java): Uses a nestedternary operatorto perform arithmetic operations in a compact, single-line expression. -
Function Calculator (
Function_Calculator.java): Usesfunctionsto 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.gitcd java-calculator-collectionjavac switch_calculator.java
javac Calculator_ElseIf.java
javac Calculator_Mini.java
javac Function_Calculator.java
javac Whats_my_birthday.javajava switch_calculatorjava Calculator_ElseIfjava Calculator_Minijava Function_Calculatorjava Whats_my_birthdayContributions are welcome! Please fork this repository and submit a pull request for any features or bug fixes you would like to add.