A simple, robust, command-line Java application for checking various types of "special" numbers and performing a few common mathematical calculations.
This application allows you to check if a given number is:
- Palindrome: Reads the same forwards and backward (e.g., 121).
- Spy Number: The sum of its digits equals the product of its digits (e.g., 1124).
- Armstrong Number: The sum of its own digits, each raised to the power of the number of digits (e.g., 153).
- Pronic Number: The product of two consecutive integers (e.g., 42 = 6 * 7).
- Perfect Number: The sum of its proper divisors equals the number itself (e.g., 28).
- Happy Number: A number which eventually reaches 1 when replaced by the sum of the square of its digits (e.g., 19).
- Prime Number: A number greater than 1 with only two factors: 1 and itself (e.g., 7).
- Ugly Number: A positive integer whose prime factors are limited to 2, 3, and 5 (e.g., 6, 10).
It can also perform the following calculations:
- Factorial: The product of all positive integers up to a given number.
- Fibonacci Sequence: Generates the first 'n' terms of the Fibonacci sequence.
- Statistics: Calculate Mean, Median, and Mode of a series of numbers.
- Number Conversion: Convert between Decimal, Binary, and Hexadecimal.
- GCD and LCM: Calculate the Greatest Common Divisor and Least Common Multiple of two numbers.
- Guess the Number Game: A mini-game to guess a random number between 1 and 100.
-
Compile the code:
javac Special_Numbers.java
-
Run the application:
java Special_Numbers
-
Follow the on-screen menu to select a calculation. The application includes input validation to prevent crashes from non-numeric input.
- Java