Objectives
- Create user-defined functions
- Use user-defined functions
- Format output
The challenge in this assignment is to write a program that asks the user for the lengths of the three sides of a triangle, determine whether the input is valid, and if it is, display the area of the triangle. There are three required functions you have to create to help streamline the mainline code.
*** first sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 3 Enter length of second side (1-100): 4 Enter length of third side (1-100): 20 That is not a valid triangle *** second sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 3 Enter length of second side (1-100): 4 Enter length of third side (1-100): 5 The area of the triangle is 6.0 *** third sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 5 Enter length of second side (1-100): 4 Enter length of third side (1-100): 3 The area of the triangle is 6.0 *** fourth sample run *** This program calculates the area of a triangle Enter length of first side (1-100): -3 Error: Number below minimum value Enter length of first side (1-100): 300 Error: Number above maximum value Enter length of first side (1-100): 3 Enter length of second side (1-100): 5 Enter length of third side (1-100): 4 The area of the triangle is 6.0 *** fifth sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 10 Enter length of second side (1-100): 30 Enter length of third side (1-100): 15 That is not a valid triangle *** sixth sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 10 Enter length of second side (1-100): 20 Enter length of third side (1-100): 30 That is not a valid triangle *** seventh sample run *** This program calculates the area of a triangle Enter length of first side (1-100): 10 Enter length of second side (1-100): 21 Enter length of third side (1-100): 30 The area of the triangle is 54.5