CSE PROGRAM #3: Solution

$30.00 $24.00

Outcomes: 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, https://www.mathsisfun.com/algebra/trig-finding-angle-right-triangle.html &…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)

Outcomes:

  • 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, https://www.mathsisfun.com/algebra/trig-finding-angle-right-triangle.html & https://everydaycalculation.com/right-triangle-calculator.php

to learn about properties of a right triangle. You need to learn to calculate the hypotenuse and angles from the sides. This will be useful as you code, because it will let you create triangles to test with your Java program.

Consider the following sketch:

B (x1,y1)

c

a

A (x2,y2)

C (x0,y0)

b

Where:

  • A, B, and C are the vertices of the right triangle.
  • a,b, and c are the length of the sides of the right triangle.
  • Notice that in the triangle ABC, x0 is the same as x1, and y0 is the same as y2.
  • For this assignment, assume that x0, y0, x1, y1, x2, and y2 are positive numbers (they could be decimal numbers too) i.e. x00.0, y00.0, x10.0, y10.0, x20.0, and y20.0

Calculations:

  • The above sketch shows a triangle ABC with three vertices A, B, and C; and the three coordinates of the three vertices.
  • Given the coordinates for the vertices A and B, compute the following measures for the triangle ABC:
    1. Find the coordinates of C.
    2. Find the length of side a, b, and c.

    3. Find the angle A, angle B and angle C.

    4. Find the area, and perimeter of the triangle.

Your program should match this format as closely as possible.

Sample run 1:

Sample run 2:

Requirements: Your program should meet all the following requirements:

  • The class name should be Triangle

  • Prompt the user to enter the three-letter name of the triangle as a String. Each letter name is a vertex of the triangle. The user should type in this name as one String without any spaces.

  • Prompt the user to enter the coordinates for vertex A (or its equivalent name) and vertex B (or its equivalent name) of a right triangle (given in order corresponding to the letters the user entered)

  • When displaying the name of the vertices and angles, these need to be converted to uppercase.

  • When displaying the name of the sides, these need to be converted to lowercase.

  • Using System.out.printf(), display all the results of calculations for that triangle:

    • A : (x2, y2) (or its equivalent name),

    • B : (x1, y1) (or its equivalent name),

    • C : (x0, y0) (or its equivalent name),

    • Side a (or its equivalent name),

    • Side b (or its equivalent name),

    • Side c (or its equivalent name),

    • Angle A (or its equivalent name),

    • Angle B (or its equivalent name),

    • Angle C (or its equivalent name),

    • Perimeter, and

    • Area

Submit your Triangle.java source code file only.

CSE PROGRAM #3: Solution
$30.00 $24.00