Menu

[Solved]Write Code Application Calculateperimeter Computer Calculates Displays Perimeter Triangle Q37043095

You are to write code for the application CalculatePerimeterwhere the computer calculates and displays the perimeter of atriangle, provided the three double values entered from keyboardinput represent a triangle. If they don’t, the computer shoulddisplay the fact that (at least, in the case of non-positive input)one of the values does not form a valid triangle. What makes avalid triangle? All sides must be positive and the sum of any twosides must be greater than the value of the third side. When anyside is non-positive, the machine should display a messageconveying the fact that all sides must have a positive value. Ifone of the sides is too long, the machine should display the valueof this side and an appropriate message. If all sides are OK, thecomputer displays the perimeter of the triangle, accurate to twodecimal places. What follows are nine sample runs. You are to runyour application using the sample values for all these runs becausethey exhaustively test your logic. A submission with just one ortwo sample runs will be considered inadequate in the extreme. Justuse the values given in these runs, and your submission will befine: Enter the three sides of the triangle: -2.82 3.25 1.03 Thisdoes not form a proper triangle. All lengths must have a positivevalue. Enter the three sides of the triangle: 6 0 3 This does notform a proper triangle. All lengths must have a positive value.Enter the three sides of the triangle: 4.8 3.6 -5.7 This does notform a proper triangle. All lengths must have a positive value.Enter the three sides of the triangle: 6.2 3.7 2.5 This does notform a proper triangle. The side with length 6.20 is too large.Enter the three sides of the triangle: 6.75 15.88 7.62 This doesnot form a proper triangle. The side with length 15.88 is toolarge. Enter the three sides of the triangle: 1.6 5.2 8.8 This doesnot form a proper triangle. The side with length 8.80 is too large.Enter the three sides of the triangle: 5 3 4 The triangle’sperimeter is 12.00 Enter the three sides of the triangle: 6.129.225 8.7 The triangle’s perimeter is 24.04 Enter the three sidesof the triangle: 7.11 6.32 10.16 The triangle’s perimeter is23.59

Expert Answer


Answer to You are to write code for the application CalculatePerimeter where the computer calculates and displays the perimeter of… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *