Question: This code doesn't work would you please help correct it its in C# language string filename = C:/Users/deept/source/repos/WeatherFinderIncsharp/WeatherFinderIncsharp/weather.txt; //If file found read data 1/Save into

 This code doesn't work would you please help correct it itsin C# language string filename = "C:/Users/deept/source/repos/WeatherFinderIncsharp/WeatherFinderIncsharp/weather.txt"; //If file found read data

This code doesn't work would you please help correct it its in C# language

string filename = "C:/Users/deept/source/repos/WeatherFinderIncsharp/WeatherFinderIncsharp/weather.txt"; //If file found read data 1/Save into list if (File. Exists(filename)) // Read a text file line by line. string[] lines = File. ReadAlllines(filename); foreach (string line in lines) weather w; string[] temp = Regex.Split(line, ";"); w.date = temp[@]; w.precipitation = Double.Parse(temp[1]); w.maxTemp = int.Parse(temp[2]); w.mintemp = int.Parse(temp[3]); weathers.Add(w); // select a date from date time picker //Then click on button will shoqw the details of weather on 1/that particular date 1 reference private void btnWeather_Click(object sender, EventArgs e) string date = myDatePicker.value. ToString("M'/'d/yyyy"); foreach (weather win weathers) if (w.date. CompareTo(date) == 0) MessageBox.Show("Date: " + w.date + " Precipitation: + w.precipitation. ToString("#.##) + " High Temperature: " + w.maxTemp.ToString() + " Low Temperature: "+w.minTemp.ToString(); break; 3AO + + 5 //weather structure 4 references struct weather public string date; public double precipitation; public int maxTemp; public int minTemp; public partial class Form1 : Form //List for weather storage private Listcweather Weathers = new Listcweather>(); 1 reference public Form1() InitializeComponent(); private void Form1_Load(object sender, EventArgs e) //Format Exception the date on the date time picker as our requirement myDatePicker.Format = DateTimePickerFormat.Custom; myDatePicker.CustomFormat = "M/d/yyyy"; //file name string filename = "C:/Users/deept/source/repos/WeatherFinderInCSharp/WeatherFinderIncsharp/weather.txt"; I/If file found read data //Save into list if (File. Exists(filename)) // Read a text file line by line. string[] lines = File. ReadAllLines (filename); foreach (string line in lines)

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!