I just started my first highschool programming class this semester and it seems we are delving into Java a bit too quickly and deeply for anyone in the class to understand.
Despite this, our teacher decided to give us an assignment that most likely seems simple to him yet is too challenging for us (we barely understand how to create basic object contructors, for/while loops, etc.).
This is the outline of the assignment:
Introduction
To travel “as the crow flies” is an expression that refers to travelling between two points directly. A bird isn’t hindrered by only travelling on roads or sidewalks. Obviously this is the shortest route.
Objective
Create a program that accepts as input two points on a Cartesian plane. Your program will then output the distance between the points “as the crow flies” as well as the distance by travelling on on a North-South-East-West road grid. The program will also output the difference in distance. Between the two means of travel.
If that isn’t enough, your program must also determine the equation of the line that the crow would fly from one point to the other.
Details
* 5 series of points will be written in a text file called “data1.txt” (provided by me)
* All points will form a diagonal line
* equations of lines must be in y=mx+b form
* All points will be in quadrant 1 (no negative numbers)
* All calculated distances must be rounded to one decimal point
* Output must be written to a file called “outfile.txt”
* Points will be written in input as 2 1 4 11
o Represents (2,1) (4,11)
Sample Input
2 2 8 6
o 3 4 7 12
Sample Output
As the crow flies distance: 7.2
Street distance:10
Difference: 2.8
Crow equation: y = 2/3x + 2/3
As the crow flies distance:8.9
Street distance:10
Difference: 12
Crow equation: y = 2x - 2
Grading & Submission
* Due: Wednesday March 9
* Late penalty: 2^n% per day, where n is the number of days late. To a max of 5 days.
* Completion = 20 marks, Style = 5 marks
* All java files must be submitted electronically & printed
* Java files must also be sumbitted in hardcopy
* Output file must be submitted in hardcopy
* Additionally, your program will also be tested using another input file
Obviously, I'm not asking anyone to do my assignment for me. We've been taught to pseudocode first, but I'm not really even sure about that, as I don't know enough about Java to be able to break up a program into plain English directions and go from there. We were told we'd be using arrays, and by talking to people who know something about computer programming, I've been advised to create a 100 x 100 array and use that to input coordinates and find the two distances, the difference, and the formula for the line.
I haven't the faintest idea on how to begin this program, so tips, pointers and ideas are welcome!