Java Bootcamp – Workbooks and Challenges
)}

Workbook 3.4

From Java Bootcamp Resources -> Module 1 -> 3. Booleans and Conditionals, open Workbook 3.4.

The Weather Network


The workbook starts with a temperature (Celsius). There's also an empty String variable: forecast.

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.

  • Between -15 and -1:

The forecast is FREEZING! Stay home!

  • Between 0 and 10:

The forecast is Chilly. Wear a coat!

  • Otherwise:

It's warm. Go outside!

Run your code.


>>It's warm. Go outside!

Run some test cases


1. Change the temperature to -12:

>>The forecast is FREEZING! Stay home!

2. Change the temperature to 5:

>>The forecast is Chilly. Wear a coat!

Good Luck!


Feedback Summary
4.8
39 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.