Question
Q2: Using your own coding example, or modifying the coding examples in the lecture, write a working Java program using switch construct that: First declares
Q2: Using your own coding example, or modifying the coding examples in the lecture, write a working Java program using switch construct that: First declares a variable of an appropriate data type and initializes it with the temperature of the day. Write a switch body to check if temperature of the day is equal to 90, 80, 70, or 60, and display appropriate message relevant to the temperature of the day as follows: i) if temperature of the day is 90 display on the console message BURNING HOT ii) if temperature of the day is 80 display on the console message HOT ii) if temperature of the day is 70 display on the console message PLEASANT iv) if temperature of the day is 60 display on the console message COLD If no condition is TRUE, set the default to display on console message TEMPERATURE COULD NOT BE DISPLAYED.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started