Are you pressed for time and haven’t started working on your assignment yet? Would you like to buy an assignment? Use our custom writing services for better grades. Even if your deadline is approaching fast, our writers can handle your task right when you need it. Our writers will complete your order from scratch and make sure it’s completely unique.

Order a Similar Paper Order a Different Paper

Build your project in NetBeans using the Run – Build Project, or Run – Clean and Build Project menu

From the dist directory you will execute your program from the command line with two filenames as
arguments, input file name and output file name. For example:

java -jar lab5.jar..input.txt ..output.txt

Write a java program that will prompt the user for two city and province names from a select list.

Read each of the records from the input file and extract the two records that match those
requrested by the user.

Define a class named Cruncher which will do all the ‘heavy lifting’ in this program.

The main line of your solution will look exactly like this:

public static void main(String[] args)
  if(args.length < 2)
  System.err.println(“Usage: java -jar lab5.jar infile outfile”);

  Cruncher dataManipulator = new Cruncher(args[0], args[1]);


Latitude is measured in degrees and minutes with zero at the equator and 90 degress at the North pole or South pole. Latitude has to be expressed as North or South. There is usually a third number, seconds but it is not in our data, just degrees and minutes. Longitude is also measured in degrees and minutes with zero located a little outside London England (Greenwich). Longitude must be expressed as West or East and it ranges from zero to 180 degrees. All the data in Canada will be North and West and simplifies our calculation a little bit.

Here is the code to calculate the distance between two cities given longitude and latitude:

double earthRadius = 6371;  // in km
  double distance = Math.acos(Math.sin(Lat1) * Math.sin(Lat2) + 
  Math.cos(Lat1) * Math.cos(Lat2) *
  Math.cos(Long2 – Long1)) * earthRadius;

The values you feed into the trig functions are in radians. You will be reading
strings of text in degrees and minutes. So your program will have to convert
strings to doubles as degrees and minutes and then convert those doubles to
decimal degrees and then convert that to radians. Here is a non-Java
description of what I mean:

degree = 23
minute = 45
decimaldegree is then 23.75 because there are 60 minutes in a degree ( our data does not have seconds )
radians = decimaldegree * PI/180

Do you need help with this or a different assignment? Even when your task is complicated and the deadline is in less than 2 days, you still have every chance to get a good grade for it. How? By completing the order form, you will get the finest custom-written assignment at an affordable price. We also deliver a number of services for free (e.g., revisions, editing, checking the text for authenticity). Use our paper writing service to receive effective help with your homework.

Order a Similar Paper Order a Different Paper