This project is a simple Voting System implemented using Spring Boot. The application allows users to save persons, check their voting eligibility, display all persons, vote, delete persons, and exit the system.
- Save Person
- Check Voting Eligibility
- Display All Persons
- Vote
- Delete Person
- Exit
- Java 11 or higher
- Maven
- A database (e.g., H2, MySQL, PostgreSQL)
-
Clone the repository:
git clone https://github.com/yourusername/simple-voting-system.git cd simple-voting-system -
Configure the database:
Update the
application.propertiesfile with your database configurations.spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password=password spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.h2.console.enabled=true
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
Once the application is running, you can interact with it using the console. The following options are available:
[1] for save person
[2] for checking eligibility
[3] for display
[4] for Voting
[5] to delete
[6] for exit
Save a new person to the system.
Check if a person is eligible to vote.
Display all persons in the system.
Vote for a party.
Delete a person from the system.
Exit the application.
Here's an example interaction with the system:
[1] for save person
[2] for checking eligibility
[3] for display
[4] for Voting
[5] to delete
[6] for exit
Choose an option: 1
- Enter person details:
Name: John Doe, Age: 25, Voting Eligible: true
Choose an option: 2
- Enter person ID to check eligibility:
1 - Output:
Person is eligible to vote.
Choose an option: 3
- Output:
Displaying all persons...
Choose an option: 4
- Enter person ID and party to vote:
1, Party: A - Output:
Vote recorded successfully.
Choose an option: 5
- Enter person ID to delete:
1 - Output:
Person deleted successfully.
Choose an option: 6
- Output:
Exiting...
- Spring Boot - Framework for building Java applications
- Maven - Dependency Management
- Your Name - Initial work - Subash Sriniwas M
- Hat tip to anyone whose code was used
- Inspiration
- etc