Question: Part 1. Write a class for representing weather with the following attributes and methods Attributes int tempF /Temp in F int windSpeed I/wind speed in
Part 1. Write a class for representing weather with the following attributes and methods Attributes int tempF /Temp in "F int windSpeed I/wind speed in mph; int windChill; A value which shows the cooling effect of the wind in combination with low temperatures, in North America it is calculated based on the following formula: 35.74+0.62157-35.75V60.4275V06 Wind chill index F V- Wind velocity, mph T-Air temperature,T bool severe .If Wind Chill is less than-15 "F, it is considered as sever .Note: you need to decide carefully what is private and what is public and design constructors, set/get methods as needed Methods A no arguments constructor which initializes everything to some default values, windChill should be calculated based on the above A two argument constructor which takes two arbitrary alues and assigns them to tempF should be calculated based on the above formulae and windSpeed, windChill and e Set and Get methods for the first two attributes; using set and get methods enables you to keep the object in a valid state, like . Temperature should be between-50 and 150 Wind speed should be greater than 0 .Changing tempF or windSpeed should update windChill and sever double getWindChill) /Returns the value of windchill; boolean isSevere): I/ returns the severity String toString) // returns a meaningful string representing the object, for example: Current Temperature is 13 'F. Feels Like-3.6 F and Wind Speed is 17 mph
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
