Java Bootcamp – Workbooks and Challenges

Workbook 3.6

From the Java Bootcamp Resources, launch the Workbook 3.6 folder.

Screen Shot 2022-10-16 at 7.03.08 PM.png

Your Calendar

The code starts with a day variable. Your friend wants to hang out on that day.

public class Calendar { public static void main(String[] args) { String day = "Friday"; System.out.println("Hey, are you free on " + day + "? \n"); System.out.println("Hmm, let me check my calendar."); } }

>>Hey, are you free on friday?


>>Hmm, let me check my calendar.

Task 1 - Check your calendar

Check that day against 7 days from your calendar.

  • case Monday, print:

Sorry, I have to stay at work late.

  • case Tuesday, print:

It looks like I have meetings all day.

  • case Wednesday, print:

I have a dentist appointment. Some other time!

  • case Thursday, print:

Sorry, thursday is date night!

  • case Friday, print:

I'm free!!

  • case Saturday, print:

I'm free!!

  • case Sunday, print:

I'm free!!

  • default:

That's not a day.

Run your code.

Test Case 1

String day = "Friday";

>>: I'm free!!

Test Case 2

String day = "Saturday";

>>: I'm free!!

Test Case 3

String day = "Monday";

>>: Sorry, I have to stay at work late.

Visualizing the Runtime

After you solve this workbook, I still recommend watching the video solution on Udemy.

Screen Shot 2022-10-17 at 3.00.19 PM.png

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
43 students





Written Reviews
There are no written reviews yet.