[Solved] CSE174-program4-TriangleMath

$25

File Name: CSE174-program4-TriangleMath.zip
File Size: 263.76 KB

SKU: [Solved] CSE174-program4-TriangleMath Category: Tag:
5/5 - (1 vote)
  • Write programs that obtain user input
  • Write programs that compute mathematical results
  • Write programs that work with Strings
  • Write programs that display numbers formatted according to a given specification
  • Format and comment source code that adheres to a given set of formatting guidelines

Preliminaries:

Before beginning to code, use the following website, http://tube.geogebra.org/m/1601355, to experiment with the triangle. This will be useful as you code, because it will let you create triangles to test with your Java program. Note that:

  • The sketch shows the area and perimeter of the triangle.
  • The left side of the screen shows the coordinates of the three vertices of the triangle, as well as the length of each side.
  • The centroid of the triangle has been marked, and its coordinates can be found on the left side of the screen. The centroid is the balance point of a shape. If you were to cut out the shape and try to balance it on your finger, the centroid is where your finger would need to be.
  • You can drag the triangles vertices and all the measurements are automatically updated.
  • You can also manually type in the coordinates of each vertex using the left side of the screen. This also automatically updates all measurements.

Also, do a little research on incircles. The incircle of a triangle is the largest circle that can fit inside it. An example of a triangle and its incircle are shown here:

Also, you need to be able to extract letters from a String and to convert a String to uppercase. The charAt(), substring(), and toUpperCase() methods are useful. You may choose to use one or more of these in the assignment.

Requirements: You will write one Java class, TriangleMath

Your program should:

  • Prompt the user to enter the three-letter name of a triangle. Each letter names a vertex of the triangle.
  • Prompt the user to enter the coordinates for the three vertices of that triangle (given in order corresponding to the letters the user entered).
  • Display various calculations for that triangle, including:
    • The name and length of each side
    • The perimeter and area
    • The coordinates of the triangles centroid (the centroid is the triangles center of mass, or balance point)
    • The length of the radius of the triangles incircle
    • The area of the triangles incircle

Below is a sample run of the program. Your program should be formatted as close to that sample as possible, including spacing, rounding (all values rounded to three places after the decimal point), and so on. The more closely you match, the better. Note that the user input is shown in bold and red. You are NOT supposed to print those. Those are typed by the user.

  • Create a folder named program4.
  • Inside that folder place exactly one file: TriangleMath.java
  • Zip the program4 folder (not just the file in the folder, but the entire folder).
  • Name the zip file zip.

Sample run. Your program should match this format as closely as possible

Enter a three letter name for your triangle: jqcCoordinates of vertex J: .1 .1Coordinates of vertex Q: 2.2 .1Coordinates of vertex C: 1.15 .7 Side lengths JQ: 2.100QC: 1.209CJ: 1.209 Other measures Perimeter = 4.519Area = 0.630Centroid = (1.150, 0.300)Incircle radius = 0.279Incircle area = 0.244

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE174-program4-TriangleMath
$25