C# program to calculate zip code distance (radius) from a csv file
$10-30 USD
Terminado
Publicado hace más de 10 años
$10-30 USD
Pagado a la entrega
I need help with my final. It is a c# program to calculate zip code distance from a csv file. The design was done for us and about half the program. We just have to fill in the rest. Here is how we were told we have to do it.
Your task is to build a C# application that can search adjacent cities and zip codes within a given distance from a given zip code.
Instructions
• Use the attached template project that includes all the necessary files, controls, event handlers, and methods. You will just need to define the ZipCode class properly and fill out event handlers and methods of MainForm class according to the following instructions and comments inside the template project.
• First, define a ZipCode class with the following properties.
o Code – The five digit ZIP code
o City – The city name of the ZIP code
o State – Abbreviation for the state which the ZIP code is in.
o Latitude – The latitude of the ZIP code
o Longitude – The longitude of the ZIP code
• Second, implement LoadData() method that reads data (zip code, city, state, latitude, and longitude in the order from the left-most column) from a file ([login to view URL]) (refer to Tutorial 8-4) and save the data to a List type instance variable (_zipCodes). To do so, use a loop to read the .csv file line-by-line and extract code, city, state, latitude, and longitude from each row. Then create a ZipCode object by using the extracted data and add the created ZipCode object to _zipCodes list variable. This method is used in the Form_Load event hander so that it can be executed when your application is loaded and other methods can use _zipCodes list. The following figure shows some sample data.
• Third, implement FindZipCode (string code) method, which finds and returns a ZipCode object from the _zipCodes list using code parameter. There can be many ways to do the task but a simple loop will work. This method is to be used within the btnFind_Click(object sender, EventArgs e) method.
• Fourth, use the following Distance(ZipCode code1, ZipCode code2) method that can calculates the distance between two zip codes using their latitude and
longitude data. This method is also to be used within the btnFind_Click(object sender, EventArgs e) method.
// calculate distance between two zip codes
public static double Distance(ZipCode code1, ZipCode code2)
{
double d = [login to view URL];
if (code1 != null && code2 != null)
{
double r = 3956.087107103049;
double latitude1Radians = ([login to view URL] / 180) * [login to view URL];
double longitude1Radians = ([login to view URL] / 180) * [login to view URL];
double latitude2Radians = ([login to view URL] / 180) * [login to view URL];
double longitude2Radians = ([login to view URL] / 180) * [login to view URL];
d = (r * 2) *
[login to view URL](
[login to view URL](
[login to view URL]([login to view URL]((latitude1Radians - latitude2Radians) / 2), 2) +
[login to view URL](latitude1Radians) *
[login to view URL](latitude2Radians) *
[login to view URL]([login to view URL]((longitude1Radians - longitude2Radians) / 2), 2)
)
);
}
return d;
}
• Finally, complete the btnFind_Click(object sender, EventArgs e) method by referring to comments inside the project template.
Requirements and desired features
• When zip code and distance are submitted to your application, a list of zip codes and cities within the given distance should be displayed using a ListView control.
• The distance between zip codes should be calculated based on their latitudes and longitudes.
----- Bucsfan -----
Dear sir,
I'm an expert in .NET with 10 years experience working with C#.
I've read your requirement carefully. It's written clearly.
I'll take my best effort to complete it pefectly within 0.5-2 days.
Kind regards,
LY
$30 USD en 2 días
0,0 (0 comentarios)
0,0
0,0
2 freelancers están ofertando un promedio de $30 USD por este trabajo
Hi,
This should be easy to do. I can delivery the source code with all the comments in one day. And if you have the sample data of zipcodes please send me
Regards,
##BUCSFAN
Hello Sir.
My name is Vinicius and although I'm from Brazil I'm a fluent English speaker.
I can program the classes you need. Give me this chance and I'll get you a good piece of code.
Thank you for your time and looking forward to work with you.
--Vinicius Zolin