Skip to content

Commit 364a864

Browse files
Add LICENSE and enhance README with professional formatting, badges, and comprehensive documentation
1 parent 28c3cf7 commit 364a864

2 files changed

Lines changed: 140 additions & 48 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Maxwell Hauser
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 119 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,132 @@
1-
# 2D Array Operations (Java GUI)
1+
# 2D Array Operations
22

3-
A lightweight Java AWT/Swing desktop app to create and explore two‑dimensional integer arrays. It provides interactive menus to generate arrays, compute statistics, search values, and perform matrix operations with a visual grid display.
3+
![Java](https://img.shields.io/badge/Java-21-ED8B00?style=flat&logo=openjdk&logoColor=white)
4+
![Maven](https://img.shields.io/badge/Maven-3.9+-C71A36?style=flat&logo=apache-maven)
5+
![License](https://img.shields.io/badge/License-MIT-blue?style=flat)
6+
![Status](https://img.shields.io/badge/Status-Active-success?style=flat)
47

5-
## Features
6-
- Create a random 2D array with custom rows/cols and value range
7-
- Statistics: minimum, maximum, average, standard deviation
8-
- Operations: search for a value, add, subtract, and multiply arrays
9-
- Visual output: draws arrays in a grid with labels and results
10-
- Resizable window; redraws on resize
8+
A Java AWT/Swing desktop application for creating, visualizing, and manipulating two-dimensional integer arrays with comprehensive statistical analysis and matrix operations.
119

12-
## How It Works
13-
- UI shell: `Array2DOperations` (Frame with menus, drawing surface)
14-
- Core logic: `TwoDArray` (array creation, stats, search, math)
15-
- Rendering: values and outlines drawn using `Graphics`
16-
- Input: dialogs (`JOptionPane`) prompt for sizes, ranges, and search keys
10+
## ✨ Features
1711

18-
## Requirements
19-
- JDK 8+ (AWT/Swing included)
20-
- Windows/macOS/Linux
12+
- **Array Generation**: Create random 2D arrays with custom dimensions and value ranges
13+
- **Visual Display**: Interactive grid rendering with automatic resize support
14+
- **Statistical Analysis**: Calculate min, max, average, and standard deviation
15+
- **Search Operations**: Find values and display their coordinates
16+
- **Matrix Mathematics**: Add, subtract, and multiply arrays
17+
- **Menu-Driven Interface**: Intuitive menu system for all operations
18+
- **Real-Time Updates**: Automatic repainting on window resize
19+
20+
## 🚀 Quick Start
21+
22+
### Using Maven (Recommended)
2123

22-
## Quick Start (Windows PowerShell)
2324
```powershell
24-
cd "g:\My Drive\GITHUB\java\java_array_2d_operations_gh"
25+
# Build the project
26+
mvn clean package
27+
28+
# Run the application
29+
java -jar target/array-2d-operations-1.0.0.jar
30+
```
31+
32+
### Without Maven
2533

34+
```powershell
2635
# Compile
2736
javac Array2DOperations.java TwoDArray.java
2837
29-
# Run (opens a desktop window)
38+
# Run
3039
java Array2DOperations
3140
```
3241

33-
## Usage Guide
34-
- File → About: Shows a summary of features
35-
- Two Dimensional Array → Create New Array: Configure rows, columns, and value range, then generate
36-
- Statistics → (Min/Max/Avg/Std Dev): Computes and displays results below the grid
37-
- Operations → Array Search: Prompts for a key and shows location if found
38-
- Operations → Array Add/Subtract: Prompts for a second array and displays result
39-
- Operations → Array Multiply: Prompts for a second array and displays `A × B`
40-
41-
Notes:
42-
- Matrix multiply requires compatible sizes: `A[rows × k] × B[k × cols]`
43-
- Values are integers; average and standard deviation are rounded for display
44-
45-
## Project Structure
46-
- `Array2DOperations.java`: Window, menus, event handling, painting
47-
- `TwoDArray.java`: Creation, statistics, search, add/subtract/multiply helpers
48-
49-
## Common Questions
50-
- Window doesn’t update after resize? The app listens to resize events and repaints automatically.
51-
- Where are inputs entered? Via dialogs (rows, columns, low/high values, search keys).
52-
- Why is multiply disabled sometimes? If dimensions are incompatible, an error is thrown to prevent invalid math.
53-
54-
## Next Steps
55-
- Add input validation loops (reject invalid/empty values)
56-
- Export arrays/results to CSV
57-
- Color-code cells by magnitude or highlight search hits
58-
- Keyboard shortcuts for frequent actions
59-
60-
## License
61-
This example is provided as-is for educational and demonstration purposes.
42+
## 📖 Usage Guide
43+
44+
### Menu Options
45+
46+
#### File Menu
47+
- **About**: Display feature summary and application info
48+
49+
#### Two Dimensional Array Menu
50+
- **Create New Array**: Configure rows, columns, and value range to generate random array
51+
52+
#### Statistics Menu
53+
- **Minimum**: Find and display smallest value
54+
- **Maximum**: Find and display largest value
55+
- **Average**: Calculate mean value
56+
- **Standard Deviation**: Compute statistical deviation
57+
58+
#### Operations Menu
59+
- **Array Search**: Find specific value and show its location
60+
- **Array Add**: Add two arrays element-wise
61+
- **Array Subtract**: Subtract second array from first
62+
- **Array Multiply**: Perform matrix multiplication (requires compatible dimensions)
63+
64+
## 🔢 Matrix Operations
65+
66+
### Addition & Subtraction
67+
- Arrays must have same dimensions
68+
- Element-wise operations
69+
70+
### Multiplication
71+
- Requires compatible sizes: `A[m × k] × B[k × n] = C[m × n]`
72+
- Standard matrix multiplication algorithm
73+
74+
## 🏗️ Architecture
75+
76+
### Components
77+
- **Array2DOperations.java**: Main window, menu system, event handling, rendering
78+
- **TwoDArray.java**: Core logic for array operations, statistics, and matrix math
79+
80+
### Key Features
81+
- Dialog-based input using `JOptionPane`
82+
- Custom rendering with Java Graphics API
83+
- Event-driven architecture
84+
- Thread-safe operations
85+
86+
## 📋 Requirements
87+
88+
- **JDK 21** (Temurin recommended)
89+
- **Maven 3.9+**
90+
- Cross-platform: Windows, macOS, Linux
91+
92+
## 🏗️ Building from Source
93+
94+
```powershell
95+
# Clone the repository
96+
git clone https://github.com/maxwell-hauser/java_array_2d_operations.git
97+
cd java_array_2d_operations
98+
99+
# Build with Maven
100+
mvn clean install
101+
102+
# Run tests
103+
mvn test
104+
```
105+
106+
## 💡 Tips
107+
108+
- **Dimensions**: Choose array sizes that fit comfortably in your window
109+
- **Value Range**: Select appropriate min/max values for better visualization
110+
- **Matrix Multiplication**: Ensure middle dimensions match (k in A[m×k] and B[k×n])
111+
- **Resize**: Window automatically redraws arrays when resized
112+
113+
## 🚀 Future Enhancements
114+
115+
- Enhanced input validation with retry loops
116+
- Export arrays and results to CSV
117+
- Color-coded cells based on value magnitude
118+
- Search result highlighting in grid
119+
- Keyboard shortcuts for frequent operations
120+
- Additional statistical measures (median, mode)
121+
122+
## 📄 License
123+
124+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
125+
126+
## 👤 Author
127+
128+
**Maxwell Hauser**
129+
130+
## 🤝 Contributing
131+
132+
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/maxwell-hauser/java_array_2d_operations/issues).

0 commit comments

Comments
 (0)