English | العربية
The Java Console-Based Calculator is an enterprise-grade terminal mathematical suite developed as an advanced software project for the Aptech Engineering Curriculum. Moving far beyond simplistic arithmetic calculators, this application implements 25 distinct mathematical, statistical, trigonometric, and number-theory algorithms backed by an object-oriented inheritance architecture.
Engineered with bulletproof input-validation loops, the application handles non-numeric exceptions gracefully, preventing terminal crashes during live user input sessions.
The project is structured around a multi-tier object-oriented inheritance pipeline separating boolean algorithmic logic, mathematical computation, CLI presentation, and the launcher entrypoint:
classDiagram
direction TB
class CheckBool {
+Scanner input
+isPalindrome(int num)$ boolean
+isArmstrong(int number)$ boolean
+isPrimeNo(int number)$ boolean
+findGCD(double num1, double num2)$ double
}
class MathFunction {
+double num1
+double num2
+int num
+getInput() void
+getTwoInput() void
+getIntInput() void
+addition() void
+subtraction() void
+multiplication() void
+division() void
+power() void
+square() void
+cube() void
+squareRote() void
+round() void
+ceilling() void
+floor() void
+minValue() void
+maxValue() void
+sin() void
+cos() void
+asin() void
+acos() void
+atan() void
+exponential() void
+isPal() void
+isArm() void
+isPrime() void
+average() void
+gcd() void
+lcm() void
}
class ListOption {
+OptionList()$ void
}
class E_Project_of_Aptech {
+main(String[] args)$ void
}
CheckBool <|-- MathFunction : inherits algorithms
MathFunction <|-- ListOption : binds CLI menu to math engine
ListOption <|-- E_Project_of_Aptech : inherits runtime execution
| Category | Option | Function | Mathematical Description |
|---|---|---|---|
| Basic Arithmetic | 1 |
Addition | |
2 |
Subtraction | ||
3 |
Multiplication | ||
4 |
Division |
|
|
| Powers & Roots | 5 |
Power |
|
6 |
Square | ||
7 |
Cube | ||
8 |
Square Root | ||
| Rounding & Truncation | 9 |
Round | Nearest integer ($\text{round}(x)$) |
10 |
Ceiling | Smallest integer |
|
11 |
Floor | Greatest integer |
|
| Extrema & Statistics | 12 |
Min Value | Evaluates minimum across dynamic array of |
13 |
Max Value | Evaluates maximum across dynamic array of |
|
23 |
Average | Arithmetic mean: |
|
| Trigonometry | 14 |
Sine | |
15 |
Cosine | ||
16 |
Arcsine | ||
17 |
Arccosine | ||
18 |
Arctangent | ||
| Exponential | 19 |
Exponential |
|
| Number Theory | 20 |
Palindrome | Tests if integer reads identically forward and backwards |
21 |
Armstrong Number | Tests if sum of |
|
22 |
Prime Number | Divisibility test verifying primality |
|
24 |
GCD | Greatest Common Divisor via Euclidean Algorithm: |
|
25 |
LCM | Least Common Multiple: |
|
| System | 0 |
Exit | Terminates interactive program loop |
When executed, the program presents an interactive CLI dashboard with instant validation:
Welcome to Java Console Based Caluculator *__*
Choose Number to Perform a Function ------------- or Zero To Exit
1 --> Addition
2 --> Subtraction
3 --> Multiplication
4 --> Division
5 --> Power
6 --> Square
7 --> Cube
8 --> Square root
9 --> Round
10 --> Ceiling
11 --> Floor
12 --> Min Value
13 --> Max Value
14 --> Sin
15 --> Cos
16 --> Asin
17 --> Acos
18 --> Atan
19 --> Exponential
20 --> Palindrome,
21 --> Armstrong number
22 --> Prime number
23 --> Average
24 --> GCD
25 --> LCM
0 --> Exit
> 24
Enter two numbers to find the GCD:
Enter First Number: 48
Enter Second Number: 18
The greatest common divisor of 48.0 and 18.0 is: 6.0
Java_Console_based_Calculator/
├── src/
│ └── e_project_of_aptech/
│ ├── CheckBool.java # Number theory predicates (Palindrome, Armstrong, Prime, GCD)
│ ├── MathFunction.java # Core mathematical & trigonometric implementation
│ ├── ListOption.java # CLI menu rendering & validated input ingestion loop
│ └── E_Project_of_Aptech.java # Application launcher containing main(String[] args)
├── nbproject/ # NetBeans project configuration & build properties
├── build.xml # Apache Ant build script
├── manifest.mf # JAR manifest with Main-Class definition
└── README.md
You can compile and run the calculator using either standard Java CLI tools or Apache Ant.
-
Clone the Repository:
git clone https://github.com/Brosfeer/Java_Console_based_Calculator.git cd Java_Console_based_Calculator -
Compile the Sources:
mkdir -p bin javac -d bin src/e_project_of_aptech/*.java -
Run the Application:
java -cp bin e_project_of_aptech.E_Project_of_Aptech
If you have Apache Ant installed:
# Compile and build the project
ant compile
# Execute directly from Ant
ant run
# Package into a standalone executable JAR
ant jar
java -jar dist/Java_Console_based_Calculator.jarبرنامج الآلة الحاسبة العلمية ونظرية الأعداد (Java Console Calculator) هو مشروع برمجي متقدم مبني بلغة جافا (Java) ضمن متطلبات مشروع Aptech البرمجي. يتجاوز هذا البرنامج حدود الآلات الحاسبة البسيطة ليقدم 25 دالة رياضية وخوارزمية وخوارزميات في نظرية الأعداد ضمن معمارية برمجية كائنية التوجه (OOP) مبنية على الوراثة النظيفة (Inheritance).
- العمليات الحسابية والأسس: الجمع، الطرح، الضرب، القسمة مع التقريب لخانة عشرية، والأسس، المربعات، والمكعبات والجذور التربيعية.
-
علم حساب المثلثات واللوغاريتمات: حساب دوال الجيب وجيب التمام والظل والدوال العكسية (
$\sin, \cos, \arcsin, \arccos, \arctan$ ) بالإضافة للدوال الأسية ($e^x$ ). -
خوارزميات نظرية الأعداد (Number Theory):
- فحص الأعداد المتناظرة (Palindrome Numbers).
- فحص أرقام آرمسترونغ (Armstrong Numbers).
- خوارزمية اختبار الأعداد الأولية (Prime Number Checker).
- حساب القاسم المشترك الأكبر (GCD) عبر خوارزمية إقليدس.
- حساب المضاعف المشترك الأصغر (LCM).
- المعالجة الآمنة للمدخلات (Exception-Safe Input): حماية تامة للطرفية من الانهيار عند إدخال حروف بدلاً من الأرقام، مع إعادة التوجيه الفوري لطلب رقم صحيح.
-
معمارية OOP نقية: فصل منطق الشروط المنطقية (
CheckBool) عن العمليات الرياضية (MathFunction) وعن واجهة الطرفية (ListOption).
Engineered with architectural discipline by Sharaf (@Brosfeer) — Principal Mobile & Systems Architect & Founder of SayaSky Studio.
- GitHub: @Brosfeer
- Studio: SayaSky Studio (Google Play)
- Specialization: Mobile Systems, Real-Time Telemetry & Clean Architecture
Distributed under the MIT License. See LICENSE for details.