
Java vector
5952
$$
- Posted:
- Proposals: 0
- Remote
- #13605
- Archived
Description
Experience Level: Intermediate
A vector can be thought of as a line in n-dimensional space.It can be defined by its two end points.Each end point is an n-tuple, with a value for each dimension.We can compute the lenght of a vector by the following algorithms:
For each dimension n.
Find the length in this dimension.(finish - start).
Square the length.
Multiply together the length in all dimensions.
Take the square root of the product.
This is simply stating pythagoras theorem.Try in two dimensional space to(i.e simple graph) to convice yourself that is correct.
Now write a java program which does the following:
Has a filename passed into the main method(i.e as a command line parameter).
Reads from that file the data representing a series of vectors(see below for the file format).
Stores each vector in a suitable data structure.
Iterate through that data structure calculating the length of each vector, printing the data to another file.
HERE IS THE SEE BELOW
THE INPUT FILE WILL DEFINE a series of vectors,each represented on three lines .For each vector:
The first line will be a single integer defining the dimensions of this vector n.
The second line will have n integers in it, representing the start point of this vector.
The third line will haven integers in it, representing the end point of this vector.
In lines containing more than one integer the integer values will be seperated by a single space.
IMPORTANT NOTICE:USE JAVA IDE.
For each dimension n.
Find the length in this dimension.(finish - start).
Square the length.
Multiply together the length in all dimensions.
Take the square root of the product.
This is simply stating pythagoras theorem.Try in two dimensional space to(i.e simple graph) to convice yourself that is correct.
Now write a java program which does the following:
Has a filename passed into the main method(i.e as a command line parameter).
Reads from that file the data representing a series of vectors(see below for the file format).
Stores each vector in a suitable data structure.
Iterate through that data structure calculating the length of each vector, printing the data to another file.
HERE IS THE SEE BELOW
THE INPUT FILE WILL DEFINE a series of vectors,each represented on three lines .For each vector:
The first line will be a single integer defining the dimensions of this vector n.
The second line will have n integers in it, representing the start point of this vector.
The third line will haven integers in it, representing the end point of this vector.
In lines containing more than one integer the integer values will be seperated by a single space.
IMPORTANT NOTICE:USE JAVA IDE.
IBRAHEEM H.
0% (0)Projects Completed
-
Freelancers worked with
-
Projects awarded
0%
Last project
7 Mar 2026
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies