Question: Please do all parts! Determining the Season in Java: You should adjust the following code to output a probable season (winter, spring, summer, or, fall)
Determining the Season in Java: You should adjust the following code to output a "probable" season (winter, spring, summer, or, fall) depending on a temperature inputted from the user. This program prompts the user for a temperature, parses that response to an integer, and displays a message box that reads "Based on the temperature of (whatever temperature they entered) it is most likely". This program will not compile at this time since you do not have a determineSeason method yet. Your job is to create a new functional method called determineSeason that returns the season based on the temperature. You will need to use conditionals to make this program determine the probable season that matches what the user entered for their temperature. /* This is a simple Java program that guesses the season * depending on the temperature entered. */ import javax.swing.*: public class Seasons { public static void main (String[] args) { int inputTemp: String response = JOptionPane.showInputDialog (null, "Enter the temperature", "Probable season", 1): String message = "Based on the temperature of" + inputTemp + "it is most likely" + determineSeason (inputTemp): JOptionPane. showMessageDialog (null, message): } } Criteria: Invalid: Temperature is greater than 130 or less than -20 Summer: Temperature is greater than or equal to 90. Spring: Temperature is greater than or equal to 70 and less than 90. Fall: Temperature is greater than or equal to 50 and less than 70. Winter: Temperature is less than 50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
