An open API service indexing awesome lists of open source software.

https://github.com/tmhsdigital/java

Java & JS
https://github.com/tmhsdigital/java

Last synced: 11 months ago
JSON representation

Java & JS

Awesome Lists containing this project

README

          

# Java Demonstrations

This repository contains simple Java demonstration projects.

## Project List

1. **Hello World**
2. **Simple Calculator**
3. **Tic-Tac-Toe Game**

---

### Hello World

A basic "Hello World" program.

#### Running the Hello World Program

To run the Hello World program, navigate to the `HelloWorld` directory and use the following command:

```sh
cd HelloWorld
javac Main.java
java Main
Simple Calculator
A simple calculator that performs basic arithmetic operations.

Running the Calculator Program
To run the Calculator program, navigate to the Calculator directory and use the following command:

sh
Copy code
cd Calculator
javac Calculator.java
java Calculator
Tic-Tac-Toe Game
A command-line Tic-Tac-Toe game for two players.

Project Structure
bash
Copy code
/src
/TicTacToe
Game.java
Player.java
TicTacToe.java
Enhancements
Added comments to explain the purpose and functionality of each method and section of code.
Extracted magic numbers and defined constants for them.
Used enums for players instead of characters.
Added input validation to handle invalid inputs more gracefully.
Separated game logic from the user interface.
Running the Tic-Tac-Toe Game
To run the Tic-Tac-Toe game, navigate to the TicTacToe directory and use the following commands:

sh
Copy code
cd TicTacToe
javac *.java
java TicTacToe.TicTacToe
How to Run the Entire Project
Navigate to the src directory and follow the instructions for each individual project:

sh
Copy code
cd src
For Hello World:

sh
Copy code
cd HelloWorld
javac Main.java
java Main
cd ..
For Simple Calculator:

sh
Copy code
cd Calculator
javac Calculator.java
java Calculator
cd ..
For Tic-Tac-Toe Game:

sh
Copy code
cd TicTacToe
javac *.java
java TicTacToe.TicTacToe
cd ..
Contributions and Feedback
Feel free to fork this repository and make your own contributions. If you have any feedback or suggestions, please open an issue or submit a pull request.

License
This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments
Thanks to the open-source community for providing resources and inspiration.
markdown
Copy code

### Committing the Updated `README.md`

1. **Update the README.md**:

Ensure the `README.md` file is saved with the above content.

2. **Commit and Push Changes**:

Run the following commands in your terminal:

```sh
git add README.md
git commit -m "Update README with project details and enhancements"
git push origin main