Skip to content

Commit b907bc0

Browse files
committed
feat: Add meal suggestion logic based on time and weather conditions
✅ Logic: - Determines meal type (breakfast, lunch, dinner) based on hour in 24-hour format - Chooses location depending on whether it's raining - Displays fallback message if time is outside meal hours. Signed-off-by: Somesh diwan <[email protected]>
1 parent afe4763 commit b907bc0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
public class Practice4 {
2-
public static void main(String[] args)
3-
{
2+
public static void main(String[] args) {
43
int hour24Format = 13; //13 hours is equivalent to 1 P.M.
54
boolean isItRaining = false;
65
System.out.println("I'm hungry, let's eat something.");
7-
if (7 < hour24Format && hour24Format < 11 )
8-
{
6+
7+
if (7 < hour24Format && hour24Format < 11 ) {
98
System.out.print("Let's have breakfast at ");
109
if (isItRaining)
1110
System.out.println("the kitchen.");
1211
else
1312
System.out.println("the back yard.");
1413
}
15-
else if (11 <= hour24Format && hour24Format < 15)
16-
{
14+
15+
else if (11 <= hour24Format && hour24Format < 15) {
1716
System.out.print("Let's have lunch at ");
1817
if (isItRaining)
1918
System.out.println("the dining room.");
2019
else
2120
System.out.println("a restaurant.");
2221
}
23-
else if (hour24Format < 21)
24-
{
22+
23+
else if (hour24Format < 21) {
2524
System.out.print("Let's have dinner at ");
2625
if (isItRaining)
2726
System.out.println("the dining room.");
2827
else
2928
System.out.println("the mall.");
3029
}
30+
3131
else
3232
System.out.println("Thinking it through... this is no time to eat.");
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)