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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!