Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ The interactive session part ] Interactive Session Enter first number:3 Enter second number:4 Enter third number:5 3,4,5: perimeter=12 area=6 Enter first number:3 Enter second

image text in transcribed

[The interactive session part]

Interactive Session

Enter first number:3 Enter second number:4 Enter third number:5 3,4,5: perimeter=12 area=6 Enter first number:3 Enter second number:4 Enter third number:8 3,4,8: not a triangle Enter first number:9 Enter second number:4 Enter third number:3 9,4,3: not a triangle Enter first number:3 Enter second number:8 Enter third number:4 3,8,4: not a triangle Enter first number:5 Enter second number:5 Enter third number:5 5,5,5: perimeter=15 area=10.8253 Enter first number:5 Enter second number:0 Enter third number:5 5,0,5: not a triangle Enter first number:5 Enter second number:0.0001 Enter third number:5 5,0.0001,5: perimeter=10.0001 area=0.00025 Enter first number:5 Enter second number:5 Enter third number:-2 5,5,-2: not a triangle Enter first number:-2

5.9: Triangles The area of an arbitrary triangle can be computed using the formula area V(s(s-a)(s-b)(s-c)) where the square root is applied to the entire product and where a, b, and c are the lengths of the sides, and s is the semiperimeter of the triangle given by the formula: s- (a b + c)/2 Write a void function named triangle that computes the area and perimeter (as well as the semiperimeter which will be used to compute the area) of a triangle based on the length of the sides. The function should use five parameters-three value parameters that provide the lengths of the edges and two reference parameters that store the computed area and perimeter respectively. Make your function robust. Note that not all combinations of a, b, and c produce a triangle. Your function should produce correct results for legal data and reasonable results for illegal combinations. Include in your submission a driver that repeatedly reads in 3 positive numbers that are the sides of a triangle, and each time print out the sides and the area and perimeter calculated by the triangle function. Your program should terminate when the first side typed in a group of three is negative or zero SAMPLE RUN #1: ./ETest Interactive Session Enter first number:3 Enter second number:4 Enter third number:5 3,4,5: perimeter-12 area 6 Enter first number:3 Enter second number:4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions