Write a C# Winform (Using 2 Forms) program to do the following: Read the data fr
ID: 3716791 • Letter: W
Question
Write a C# Winform (Using 2 Forms) program to do the following:
Read the data from the file named 1975-1979.csv (Shown at the end).
The data is in the format and separated by commas
Date- month/day/year
State- string
Fujita(tornado strength)- integer
Fatalities- integer
Injuries- integer
You decide how you want to store the data.
Convert the date field into a string with the format yyyymmdd
Convert all the integer fields listed above from string to integer
For the data read into your program, complete the following 4 tasks
==> Display the number of injuries for a specified state
==> Display the number of injuries for a specified Fujita
==> Display the Fujita rating with the highest number of fatilities
==> Display the state with the most injuries
The Snapshot of 1975-1979.csv file is given below:
11/7/1975 Louisiana 2 1/7/1975 Louisiana 3 1/8/1975 Florida 4 1/9/1975 Oklahoma 5 1/9/1975 Louisiana |??#### Arkan 8 ###?#### Texa 10 | ##?## Texas ####??# Mississippi 210 Mississippi 10006500000000018500100 00000000000000001090000 x u k u u u u u 8901 - 23456789Explanation / Answer
using System;
class Date
{
//data members
private int year;
private int monthint;
private int day;
private string monthstr;
//constructors
public Date() //default constructor
{
}
public Date(int year,int monthint,int day,string monthstr) //parameterized constructor
{
this.year = year;
this.monthint = monthint;
this.day = day;
this.monthstr = monthstr;
}
//properties for variables
public int Year
{
get
{
return year;
}
set
{
year = value;
}
}
public int Monthint
{
get
{
return monthint;
}
set
{
monthint = value;
}
}
public int Day
{
get
{
return day;
}
set
{
day = value;
}
}
public string Monthstring
{
get
{
return monthstr;
}
set
{
monthstr = value;
}
}
public string displayMonthName()
{
return ""+monthstr+" "+day+","+year;
}
public override string ToString()
{
return ""+monthint+"/"+day+"/"+year;
}
}
public class Test
{
public static void Main()
{
Date d = new Date(1977,12,1,"december");
Console.WriteLine(d.ToString());
Console.WriteLine(d.displayMonthName());
Date d1 = new Date();
d1.Year = 2016;
d1.Day = 15;
d1.Monthint = 6;
d1.Monthstring = "june";
Console.WriteLine(d1.ToString());
Console.WriteLine(d1.displayMonthName());
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.