Java Bootcamp – Workbooks and Challenges
)}

Workbook 3.4

From the Java-Bootcamp-Resources, launch the Workbook 3.4 folder.

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

The Weather Network


The workbook starts with a temperature (Celsius). There's also a String variable forecast that doesn't start with a value.

public class WeatherNetwork { public static void main(String[] args) { int temp = 25; String forecast; System.out.println(forecast); } }

Task 1 - Update the forecast.


Update the forecast variable based on the temperature.

  • Less than or equal to -1

The forecast is FREEZING! Stay home!

  • Less than or equal to 10

The forecast is Chilly. Wear a coat!

  • Otherwise

It's warm. Go outside!

Run your code.

Test Case 1:

int temp = 25;

>>: It's warm. Go outside!

Test Case 2:

int temp = -1;

>>: The forecast is FREEZING! Stay home!

Test Case 3:

int temp = 0;

>>: The forecast is Chilly. Wear a coat!

Test Case 4:

int temp = 10;

>>: The forecast is Chilly. Wear a coat!

Test Case 5:

int temp = 11;

>>: It's warm. Go outside!

Test Case 6:

int temp = -12;

>>: The forecast is FREEZING! Stay home!

Visualizing the Runtime

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

Screen Shot 2022-10-17 at 2.59.42 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
4.7
43 students
5

91%
4

2%
3

0%
2

0%
1

7%
Written Reviews
There are no written reviews yet.