Mini Projects Using JAVA
- CHEMISTRY PERIODIC TABLE GENERATOR & THE ELEMENT'S PROPERTIES GENERATOR.
- RANDAM NUMBER GENERATOR
This repository contains two Java console applications: a Modern Periodic Table and a Random Number Generator. Both applications demonstrate different aspects of Java programming and provide interactive user experiences through the command line interface.
The Modern Periodic Table application is a comprehensive program that provides detailed information about chemical elements. It uses object-oriented programming principles to organize and display element data.
class Element {
String name;
String symbol;
int atomicNumber;
String electronicConfiguration;
String discoveredBy;
String charge;
}
- The
Element
class serves as a blueprint for chemical elements - Each element instance stores six key properties: name, symbol, atomic number, electronic configuration, discoverer, and charge
- Contains a
displayDetails()
method to print element information in a formatted manner
- Contains a database of all 118 elements in the periodic table
- Elements are stored in an array where the index position corresponds to (atomic number - 1)
- Implements an interactive menu system for user interaction
- Element Database: Contains complete information for all 118 elements
- Search Functionality: Allows users to search for elements by atomic number
- Detailed Information Display: Shows comprehensive details about each element
- User-Friendly Interface: Simple menu system with clear options
- Input Validation: Ensures atomic numbers are within valid range (1-118)
- Displays welcome message and menu options
- User can choose to:
- Search for an element (Option 1)
- Exit the application (Option 2)
- When searching:
- Enter atomic number
- View detailed element information
- When exiting:
- Confirm exit choice
- Receive appropriate closing message
A versatile random number generator that allows users to generate multiple random numbers within a specified range. The application demonstrates the use of Java's Random
class and implements a loop-based menu system.
The application is contained in a single class that handles:
- User input processing
- Random number generation
- Result display
- Program flow control
- Customizable Range: Users can specify minimum and maximum values
- Multiple Number Generation: Generate any quantity of random numbers in one go
- Input Validation: Ensures valid ranges and counts
- Continuous Operation: Users can generate multiple sets without restarting
- User-Friendly Interface: Clear prompts and formatted output
- Welcome message displayed
- Main program loop begins:
- User inputs minimum value
- User inputs maximum value
- Range validation occurs
- User specifies quantity of numbers
- Numbers are generated and displayed
- After generation:
- Option to generate more numbers
- Option to exit program
- Program continues until user chooses to exit
The application includes validation for:
- Invalid ranges (minimum ≥ maximum)
- Invalid counts (less than or equal to 0)
- Java Development Kit (JDK) 8 or higher
- Command line interface or terminal
- Compile the Java files:
javac PeriodicTable.java
javac RandomNumberGenerator.java
- Run the desired program:
java PeriodicTable
# or
java RandomNumberGenerator
- Uses an array-based data structure for element storage
- Implements object-oriented principles through the Element class
- Memory efficient as elements are only created once during initialization
- Utilizes Java's
Random
class for number generation - Implements a while loop for continuous operation
- Uses Scanner class for user input handling
-
Modern Periodic Table:
- Add search by element name/symbol
- Include more element properties
- Add periodic table visualization
-
Random Number Generator:
- Add option for different number distributions
- Include duplicate number checking
- Add file output capability
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.