Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me with this Java project. Thanks Write a Weather class encapsulating the concept of the weather forecast. It has the following attributes: the

Please help me with this Java project. Thanks

Write a Weather class encapsulating the concept of the weather forecast. It has the following attributes: the temperature and the sky conditions. The only valid sky conditions are sunny, snowy, cloudy, or rainy. Include a constructor, the accessors and mutators, and methods toStringand equals. Temperature, in Fahrenheit, should be between -50 and +150; the default temperature value is 70. The default sky condition is sunny.

Include a method that converts Fahrenheit to Celsius. The formula to perform this conversion is below.

Celsius temperature = (Fahrenheit temperature - 32) * 5/9

Also include a method that checks whether the weather attributes are consistent. (NOTE: There are two cases where they are not consistent: when the temperature is above 32 and it is snowy; and when the temperature is below 32 and it is rainy.)

NOTE: The Weather class is a new class within your project. It should be defined as a separate file within your Java Project. This new class does not affect the name of your Java Project above.

Write a program that prompts the user to enter the temperature and sky condition. Display the temperature converted to Celsius and whether or not the weather attributes entered are consistent. The temperature should be formatted to exactly two decimal places.

Continuously prompt the user for input until the user chooses to end the program. Be sure to use clear prompts for the user.

Input Validation: Do not accept unreasonable/junk values from the user, which must be rejected and asked for another one.

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

More Books

Students also viewed these Databases questions