Workbook 3.5
From the Java Bootcamp Resources
, launch the Workbook 3.5
folder.
Your Work Schedule
Assume that day
can be any value between 1 (Monday) and 7 (Sunday). There's also a boolean
variable: holiday
.
public class WorkSchedule {
public static void main(String[] args) {
int day = 3;
boolean holiday = true;
}
}
Task 1 - Do I have work that day?
In the event of a holiday, print
:
Woohoo, no work
During the weekend (Saturday or Sunday), print
:
It's the weekend, no work!
Otherwise, print
:
Wake up at 7:00 :(
Run your code.
Test Case 1:
int day = 3; boolean holiday = true;
>>woohoo, no work!
Test Case 2:
int day = 3; boolean holiday = false;
>>Wake up at 7:00 :(
Test Case 3:
int day = 6; boolean holiday = false;
>>It's the weekend, no work!
Visualizing the Runtime
After you solve this workbook, I still recommend watching the video solution on Udemy.
It will show you how to visualize the runtime using Visual Studio Code.
Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
4.7
43 students
5
91%
4
2%
3
0%
2
0%
1
7%
Written Reviews
There are no written reviews yet.