Area of a Triangle.
Difficulty: (2/5)Write a program that will take the coordinates of the vertices of a triangle in 3D as command line arguments and print out the area of the triangle. For example, given the input:
% java TriangleArea 0 0 0 1 0 0 0 1 0The program should calculate the area of the triangle with vertices (0,0,0), (1,0,0), and (0,1,0), which happens to be 0.5. Hint: Use Heron's formula, or the cross product.
To test your program, calculate the area of the triangle with vertices
(1, 2, 3) (7, 8, 9) (4, -5, 10)
CS1 Deadline: 11/1/2013
Use: handin cs1113 extra1 TriangleArea.java
No comments:
Post a Comment