Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve the following problem with tester class in java programming language Weather Reporting Imagine that a TV weather reporter forecasts the weather according to the

Solve the following problem with tester class in java programming language
image text in transcribed
image text in transcribed
image text in transcribed
Weather Reporting Imagine that a TV weather reporter forecasts the weather according to the following routine. He/ She reads some data like weather patterns and environment canada reports and then determines a high temperature, low temperature, probability of precipitation (chance of rain or snow) and the anticipated conditions, such as sun, cloud, snow or rain. When the news channel calls up the weather person they generate a graphic to display on the screen and then read off their forecast As new information becomes available such as a change in the wind direction they will update their forecast so that they can generate a new graphic and a be ready in cast the news channel calls on them to once again deliver the most up to date weather For this assignment consider that a weather forecast for any given day consists of a high temperature, a low temperature, a probability of precipitation (Pop) and a predicted weather condition. An example forecast High: -10 Low: -13 Pop: 80% Weather Condition: Snow For this assignment you'll create a program that a TV weather reporter could use to forecast and keep track of the weather. You'll need to create a class that can model' a weather forecast (e.g. WeatherForecast.java) for a single day (that is a class with instance fields for high and low temperature, probability of precipitation and conditions, and the ability to retrieve and modify those fields (getters and setters) On occasion a weather person may have to give a forecast using Fahrenheit or Celsius, by default in Canada we operate in Celsius (so your WeatherForecast class should also do that) but should allow the weather person to toggle all temperatures between Celsius and Fahrenheit To test your WeatherForecast class create another class called SimpleWeatherForecast with a public static void main, it should prompt the user to enter the high temperature, low temperature POP and conditions. Then it should create a WeatherForecast object using those values and print the WeatherForecast back out to screen, convert the temperatures to Fahrenheit and once again print out the forecast Ensure this problem is in a separate folder from Problem 1 (even though you might copy over part of Problem 1's solution) You can use your same WeatherForecastClass from the first problem. However this time you should add a MultidayForecast class that allows a weather forecaster to generate any number of days worth of WeatherForecasts. It will allow a user to edit any of these forecasts- so you'll have to store the WeatherForecast objects in the MultidayForecast class (perhaps in an ArrayListprivate instance field To avoid having to enter too much information manually, your MultidayForecast class should have a method to automatically generate the desired number of forecast days (using random numbers) Ensure that the randomly generated data makes some sense (i.e., temperatures between -30 and +30 with low temperatures less than high temperatures, random POP between O and 100 and a weather condition that is one of snow, rain, cloud or sun) Once again create one more class that contains a public static void main (and perhaps other static methods) that has a simple text menu allowing a user to create a MultidayForecast with between 1 and 5 days and allows them to edit any of those forecast days and/or print the whole forecast out to screen Sample output How many days to forecast the weather for? Generating 3 days of weather forecasts... Main Menu -1: Quit 1: Display the Forecast 2: Edit the Forecast Enter Menu Choice: 1 Weather Forecast Day: High: 24.0 Low: 3.0 POP: 83 Conditions: SNOW Weather Forecast Day: 1 High:-18.0 Low: -29.0 POP: 28 Conditions: SUN Weather Forecast Day: 2 High: 29.0 Low: -22.0 POP: 51 Conditions: CLOUD Main Menu -1: Quit 1: Display the Forecast 2: Edit the Forecast Enter Menu Choice:2 which day to edit: Enter the high temp:-10 Enter the low temp:-13 Enter the POP: 83 Enter the Conditions (Example: sun, cloud, rain or snow): SNOW Main Menu -1: Quit 1: Display the Forecast 2: Edit the Forecast Enter Menu Choice:-1 good bye

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

Students also viewed these Databases questions

Question

Maintain five-figure accuracy

Answered: 1 week ago