We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,344 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Generating triangle verticies

I need some help starting my project.

You will have the following functions (no violation of these interfaces) and you may have others, as needed:
− public static void GenerateRandomTriangles(int numTriangles)
to create a file RandomTriangles.dat having the following format (including some comments like the ones
shown below) with random integer coordinates (x, y) of the three vertices of a triangle. Each x and y will be a
random integer in the range 0 <= x, y < 150. (Use seed for random numbers.)

5 //numTriangles; each line below gives integer coordinates (x, y) of vertices of a triangle
( 20, 100) ( 25, 88) (112, 99)
... ... ...
− public String TriangleType(Point a, Point b, Point c),
to return one of the values "equilateral", "isosceles", and "scalar".
− private void TestTriangles()
to test the two functions above. This function should output the points, the length of the edges (upto 3 decimal
points), and the triangle type. It should allow the user a choice to continue processing the triangles or to quit
(give a short, clear prompt).
− public static void main(String[] args)
to call the other functions for the most part.
Point will be a subclass of the main class (which you might call TestTriangleType). It will have two integer
fields/attributes, with a constructor Point(int x, int y) and another member-function public void
Print() to print the coordinates of a point.

2
Contributors
1
Reply
15 Minutes
Discussion Span
7 Months Ago
Last Updated
2
Views
Question
Answered
Kayla1993
Newbie Poster
12 posts since Sep 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

DaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Post what you have done so far and someone will help you from there.

JamesCherrill
... trying to help
Moderator
8,526 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,456
Skill Endorsements: 30
Question Answered as of 7 Months Ago by JamesCherrill

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0733 seconds using 2.68MB