Question: Programming Activity Goal: Write a program that reads the lengths of the three sides of a triangle in inches, convert them into cm and calculates
Programming Activity Goal: Write a program that reads the lengths of the three sides of a triangle in inches, convert them into cm and calculates the area of the triangle. Check the sample output below. Recall that the conversion from inches to cm: 1 inch 2.54 cm You will use the following formula to calculate the area of a triangle given the lengths of its sides: areass-x)(s-y)(s ) where x, y and z denote the sides of the triangle, and s is calculated as s-(%)(x + y + z) For this assignment, we will assume that all entries for x y, and z produce a valid triangle. You can name your program Triangle.iava When done, raise your hand to let the TA know that you are ready to demonstrate your code for grading. // import statement (s), class header, and main method header // declare variables for the inputs and outputs // prompt for inputs /I calculate area // display the outputs (2 decimal places) Sample Output Enter side x in inches: 4 Enter side y in inches: 5 Enter side z in inches: 6 For a triangle of sides 10.16 cm, 12.70 cm, and 15.24 cm Area = 64.01 square cm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
