JavaPractice
This repository contains my Java assignments for **conditional statements, loops, and modulus exercises.
All assignments are implemented using core Java, without external libraries, and demonstrate my understanding of decision-making and logic in programming.
Project Structure src/ └── com/ └── matthew/ ├── practice/ │ ├── Main.java │ └── Student.java └── primeassignment/ ├── PrimeCheck.java └── BuzzThrillsLogic1.java
src/com/matthew/practice/→ Main and Student class //This is not actually part of the assignment.src/com/matthew/primeassignment/→ Prime check assignment
Assignments
- PrimeCheck.java
- Takes an integer input from the user.
- Determines whether the number is prime.
- Demonstrates:
forloopsif-elsestatements- Logical operators (
&&,||)
- BuzzThrillsLogic1.java
- Takes an integer input from the user.
- Classifies it according to divisibility rules:
- Divisible by 3 →
"Buzz" - Divisible by 5 →
"Thrills" - Divisible by both →
"BuzzThrills" - Negative numbers →
"Negative numbers are not allowed" - Otherwise →
"Not divisible by 3 nor 5"
- Divisible by 3 →
- Demonstrates:
- Conditional statements
- Modulus operator
% - Input validation
How to Run the Programs
- Open a terminal or command prompt.
- Navigate to the
srcfolder of this project:
cd src