Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part II. (80 pts.) ile weather.txt on Blackobard contains some unknown number of

ID: 3872567 • Letter: P

Question

Part II. (80 pts.) ile weather.txt on Blackobard contains some unknown number of lines of weather data listing a town inine trom three sites (Bangor, Orono, or Calais), date, temperature (Fahrenheit), wind direction, wind speed (mph) and name of reporter. All entries are from the same month but do not assume the data set will always be for February. Names contain at least two parts separated by a blank. Names may have multiple parts (ex. Penny Jane Thomas). You may assume the file is not empty. weather.tt Notepad File Edit Format View Bangor 82/10/17 Orono 82/10/17 Bangor 82/11/17 Calais 82/11/17 Calais 02/11/17 Bangor 02/12/17 Bangor e2/13/17 Orono 02/13/17 Orono 82/13/17 Calais 82/13/17 Orono 02/14/17 Bangor 82/14/17 4.7 Dind 23.65 NW 22.0 W 25.1 W 25.75 W 21.9 N 28.5 N 26.85 N 26.9 NE 23.15 N 28.6 E 21.75 E 3.5 Pauline Stinson 3.7 Suan Speller 3.3 Tom McBride 3.9 Penny Jane Thomas 3.1 Xang Xao 3.8 Hillary Tines 3.1 Theresa Sanborn 3.2 Owen Mark Prentiss 3.1 Isaac Short 3.7 Xang Xao 3.1 Isaac Short 3.6 Jeff Byron File averages.txt on First Class contains a historical listing of month names and average temperatures in Fahrenheit. averagestt . Notepad File Edit Format View Help anuary 24.92 February 28.70 March 45.91 April 52.8e May 68.90 June 73.55 July 78.63 August 77.59 September 68.40 October 55.7 November 45.75 December 36.33 Formula for wind chill: wnd Chill (F) = 35.74 + 0.6215.. 35.75 where T-Air Temperature E 16 + 0.4275TYTI Wind Speed (mph)

Explanation / Answer


Fields: All fields are ints. Temperature is stored in Fahrenheit. Precipitation is stored in hundredths of inches.

1. dayOfMonth
2. maxTemperature
3. minTemperature
4. precipitation

Methods

* DailyWeatherData(int day, int max, int min, int precip) the constructor
* void setDayOfMonth(int day) does not allow a value to be stored outside the range 1 to 31 (inclusive)
* void setMaxTemperature(int max) does not allow values outside the range -50 to 120 (inclusive)
* void setMinTemperature (int min) does not allow values outside the range -50 to 120 (inclusive)
* void setPrecipitation (int precip) does not allow negative values
* int getDayOfMonth()
* int getMaxTemperature()
* int getMinTemperature()
* double getPrecipitation() returns the precipitation converted to inches
* double getAverageTemperature() returns the average of the MaxTemperature and MinTemperature
* String toString() returns a string in the format shown below where d = dayOfMonth, mm=MaxTemperature, nn=MinTemperature, aa.aa = AverageTemperature, and pp.pp = Precipitation in inches

import java.util.*;

public class DailyWeatherData

{

public int dayOfMonth;

//Temperature is in Fahrenheit.

public int maxTemperature;

public int minTemperature;

//Precipitation is hundrethds of inches. ex. 1/100 or 0.01

public int precipitation;

private ArrayList<String> weatherData;

/**

* Constructor for objects of class DailyWeatherData

*/

public DailyWeatherData(int day, int max,int min, int precip)

{

day = dayOfMonth;

max = maxTemperature;

min = minTemperature;

precip = precipitation;

weatherData = new ArrayList<String>();

}

public void setDayOfMonth(int day){

if(day>=1&&day<=31){

day=dayOfMonth;

}

else{

System.out.println("Value must be between 1 and 31!");

}

}

public void setMaxTemperature(int max){

if(max>=-50&&max<=120){

max=maxTemperature;

}

else{

System.out.println("Value must be between -50 and 120!");

}

}

public void setMinTemperature(int min){

if(min>=-50&&min<=120){

min=minTemperature;

}

else{

System.out.println("Value must be between -50 and 120!");

}

}

public void setPrecipitation(int precip){

}

public int getDayOfMonth(){

return dayOfMonth;

}

public int getMaxTemperature(){

return maxTemperature;

}

public int getMinTemperature(){

return minTemperature;

}

public double getPrecipitation(){

return precipitation/100.0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote