Java家庭作业 - 苦苦挣扎 [英] Java homework assignment - Struggling

查看:77
本文介绍了Java家庭作业 - 苦苦挣扎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1:地理距离计算器

编写一个应用程序来计算地理距离表。您的应用程序的输入是一个文件,其中包含

纬度/经度对的城市坐标,纬度和经度以度和分为单位给出,

如下:1


爱丁堡55; 57N 03; 13W

伦敦51; 30N 0; 30W

NorthWalsham 52; 50N 01; 22E

Norwich 52; 38N 01; 18E

注意1度= 60分钟。输出应该是一个文本填充,其中包含一个地理距离表格

公里:


爱丁堡0.00 520.90 452.43 467.11

伦敦520.90 0.00 194.50 175.33

NorthWalsham 452.43 194.50 0.00 22.57

Norwich 467.11 175.33 22.57 0.00


应用程序应采用的名称从第一个和第二个命令行参数输入fille(给出纬度/经度坐标)和输出

fille(写入距离表)。例如,如果

您的项目被称为geodist并且您的输入文件是cities.txt,则命令行


java -jar geodist.jar cities.txt distances.txt


应该将距离表写入distances.txt。


计算公里距离的程序是:一度纬度对应111公里。一个

经度对应111。 cos('')km,其中''是纬度.2例如,Norwich的公里坐标为

(111.1:3。cos(52:63度)= 87:在格林威治经度以东57公里处,111。

52:63 = 5842:赤道以北28公里处),North Walsham的那些是(91:64,5864:48)。

这两者之间的欧几里德距离是

Square.route(87:57-91:64)^ 2 +(5842:28-5864:48)^ 2 = square.route(-4:07)^ 2 +( - 22:2)^ 2 = 22:57

您的申请应包含一个充分代表a的地理位置的类城市

并为执行此计算提供了很好的支持。

1: A Geographic Distance Calculator
Write an application to calculate a table of geographic distances. The input of your application is a file containing
the coordinates of cities in latitude / longitude pairs, where latitude and longitude are given in degrees and minutes,
as in:1

Edinburgh 55;57N 03;13W
London 51;30N 0;30W
NorthWalsham 52;50N 01;22E
Norwich 52;38N 01;18E
Notice that 1 degree = 60 minutes. The output should be a text fille containing a table of geographic distances in
kilometres:

Edinburgh 0.00 520.90 452.43 467.11
London 520.90 0.00 194.50 175.33
NorthWalsham 452.43 194.50 0.00 22.57
Norwich 467.11 175.33 22.57 0.00

The application should take the names of the input fille (giving the latitude / longitude coordinates) and the output
fille (into which the distance table is written) from the first and second command line parameter. For example, if
your project is called geodist and your input file is cities.txt, the command line

java -jar geodist.jar cities.txt distances.txt

should write the distance table into distances.txt.

The procedure for calculating distances in kilometres is: One degree of latitude corresponds to 111 kilometres. One
degree of longitude corresponds to 111 . cos('') kilometres, where '' is the latitude.2 For example, the coordinates
of Norwich in kilometres are (111 . 1:3 . cos(52:63 degrees) = 87:57 kilometres east of Greenwich''s longitude, 111 .
52:63 = 5842:28 kilometres north of the equator), those of North Walsham are (91:64, 5864:48).
The Euclidean distance between these two is
Square.route(87:57- 91:64)^2 + (5842:28- 5864:48)^2 = square.route(-4:07)^2 + (-22:2)^2 = 22:57

Your application should comprise a class that adequately represents the geographic location of a city
and provides good support for carrying out this calculation.

推荐答案

您在这个问题上完成了什么?你有什么代码?你有什么想法?
What have you accomplished on this problem alone? What code do you have? What ideas do you have?


我什么都没有,希望一些真正优秀的人能在这里给我一些想法和帮助。
I have nothing, kind of hoping some Really nice people on here could give me some ideas and help really.



我什么都没有,希望一些真正优秀的人在这里可以给我一些想法和帮助。
I have nothing, kind of hoping some Really nice people on here could give me some ideas and help really.



首先,您需要进行设计。你需要什么样的设计来完成你的任务?信息流是什么样的。在高层次你需要做什么?


- 读取文件

- Tokenize并解析输入

- 做一些计算

- 然后是什么?

Well first you need to do a design. What kind of design would you need to accomplish your task? What does the flow of information look like. At a high level what do you have to do?

- Read a file
- Tokenize and parse the input
- Do some calculations on it
- Then what?


这篇关于Java家庭作业 - 苦苦挣扎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆