Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

Please do all parts! image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions