This folder contains my Day 02 Java practice tasks focused on conditional statements and decision-making.
The goal of this day is to understand how Java makes decisions based on different conditions and apply those concepts to simple programming and real-world problems.
if statementif-else statementelse-if statement%ScannerDay-02-Conditional-Statements/
β
βββ README.md
β
βββ Questions/
β βββ Questions.txt
β
βββ Solutions/
β βββ Q01_Positive_or_Negative.java
β βββ Q02_Odd_or_Even.java
β βββ Q03_Largest_of_Two.java
β βββ Q04_Smallest_of_Two.java
β βββ Q05_Largest_of_Three.java
β βββ Q06_Leap_Year.java
β βββ Q07_Student_Grade.java
β βββ Q08_Electricity_Bill.java
β βββ Q09_Discount_Calculation.java
β βββ Q10_Loan_Eligibility.java
β
βββ Screenshots/
βββ Output_1.png
βββ Output_2.png
βββ Output_3.png
βββ Output_4.png
βββ Output_5.png
βββ Output_6.png
βββ Output_7.png
βββ Output_8.png
βββ Output_9.png
βββ Output_10.png
| No. | Problem | Main Concept |
|---|---|---|
| Q01 | Positive or Negative | if-else |
| Q02 | Odd or Even | Modulus % |
| Q03 | Largest of Two Numbers | if-else |
| Q04 | Smallest of Two Numbers | if-else |
| Q05 | Largest of Three Numbers | else-if |
| Q06 | Leap Year | Conditions + % |
| Q07 | Student Grade | else-if |
| Q08 | Electricity Bill | Real-world conditions |
| Q09 | Discount Calculation | Conditions + percentage |
| Q10 | Loan Eligibility | Logical && |
Checks whether a given number is positive, negative, or zero.
Concepts used:
if-elseScannerChecks whether a number is odd or even using the modulus operator.
Concepts used:
%if-elseFinds the largest value between two numbers.
Concepts used:
if-elseFinds the smallest value between two numbers.
Concepts used:
if-elseFinds the largest value among three numbers.
Concepts used:
ifelse-ifelseChecks whether a given year is a leap year.
Concepts used:
%Calculates a studentβs grade based on their marks.
Concepts used:
else-ifCalculates an electricity bill based on the number of units consumed and adds a surcharge.
Concepts used:
Calculates the discount amount and final purchase amount based on the purchase value.
Concepts used:
Checks whether a person is eligible for a loan based on their age and monthly salary.
Concepts used:
&& operatorif-else









Open the terminal inside the Solutions folder.
cd Solutions
For example:
javac Q01_Positive_or_Negative.java
java Q01_Positive_or_Negative
You can follow the same process for the remaining programs.
To compile all Java files inside the Solutions folder:
javac *.java
Then run any program individually:
java Q01_Positive_or_Negative
java Q02_Odd_or_Even
java Q03_Largest_of_Two
The Screenshots folder contains the output screenshots for all 10 Java programs.
Each screenshot is linked to its corresponding practice question above to make it easy to understand the program execution and output.
Through Day 02, I practiced:
ifif-elseelse-if%ScannerThe main goal of Day 02 is to build a strong foundation in conditional statements and decision-making in Java.
These concepts are important for solving programming problems and will be used in upcoming Java topics.
| Day | Topic | Status |
|---|---|---|
| Day 02 | Conditional Statements | β Completed |
Learning Java step by step by practicing small problems every day.
M. Praveen Kumar
β This folder is part of my Java Daily Tasks journey to improve my Java programming and problem-solving skills.