Question
JAVA programming. Okay, so the project is to create a program that simply gives the forecast. Basically I have everything sorted out and working except
JAVA programming. Okay, so the project is to create a program that simply gives the forecast. Basically I have everything sorted out and working except for one part. The skyConditions are to be stored as an enumeration which I have. What we need to do is state if the weather is consistant. Here is the specification.
. . .
boolean consistentWeather() -- weather is determined inconsistent if:
temperature is below 32 F and it's NOT snowy
temperature is above 100 F and it's NOT sunny
. . .
This is only a snippet of the program. Basically I need to know how to make it say inconsistent weather or not.
*note the default skyCondition is sunny and default temperture is 70
public class Weather
{
public enum skyCondition {sunny, snowy, cloudy, rain}
double temperature;
skyCondition condition;
//default constructor
public Weather ()
{
temperature = 70;
this.condition = skyCondition.sunny;
}
//overloaded constructor Fahrenheit must be between -50 and 150 degrees
public Weather(double newFahrenheit, skyCondition newSkyCondition)
{
if(newFahrenheit >= -50 && newFahrenheit <= 150)
{
temperature = newFahrenheit;
}
else
{
temperature = 70;
}
condition = newSkyCondition;
}
I hope you understand and I provided enough information, if not I can provide more or even the full assignment specifications.
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