Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Please create a CH+ program to solve the following problem. Submit electronic (Canvas Dropbox) copies of your program source code and two or more

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instructions: Please create a CH+ program to solve the following problem. Submit electronic (Canvas Dropbox) copies of your program source code and two or more sample runs to me by the deadline. Late submissions will not be accepted. Documentation requirements follow the problem specification. 1. Write a program that prompts a user to enter the lengths of the sides of a triangle, classifies the triangle as equilateral, isosceles, or scalene, and computes the area of the triangle. The program begins by displaying the purpose of the program, then prompts the user to enter the lengths of the three sides. It then determines if the sides form a triangle. If they do not, the program displays a message informing the user that the sides do not form a triangle and ends. If they do, the program determines if the triangle is equilateral (3 equal sides), isosceles (2 equal sides), or scalene (no equal sides). It then computes and displays the area of the triangle, rounded to two decimal places. As usual, your program output should resemble the sample runs at the end of this document. Notes: The values for three sides form a valid triangle if the sum of the lengths of any two sides is greater than the length of the remaining side. The area of a triangle can be computed from its sides using the following formula (known as Heron's Formula): area = Vs* (s - a). (s -b)*(s - c) where a, b, and c are the lengths of the sides, and s is equal to half the sum of the sides (i.c., half the perimeter). The use of logical operators to test for valid side lengths is required for this assignment. Test your program using whole number values for the lengths of the sides, but make the variables that store the lengths of the sides type double. If you do not, you may encounter unexpected results. References: Chapter 4.8 - Logical operators (& &) Chapter 3.9 - More Math Library Functions (sort) . Documentation Requirements: Each program source code file must have a header at the beginning of the program containing the following: Name of author, PSU e-mail address of author, name of course, assignment number and due date, name of file, purpose of program, compiler and operating system used, references Example: . Author: Wanda Kunkle E-mail: wmk12@psu.edu Course: CMPSC 121 Assignment: Lab 5 Due date: 2/26/2021 File: TriangleTypeTester.cpp Purpose: This program prompts the user to enter the lengths of three sides of a triangle. If the lengths form a triangle, the program classifies the triangle as equilateral, isosceles, or scalene, then computes and displays its area; otherwise, it displays an appropriate error message and ends. Compiler: MS Visual Studio Community 2019 Operating system: MS Windows 10 Home References: Class demo programs (include any Web page references here) Sample run #1 (User enters 3 valid lengths.): Me The purpose of this program is to classify a triangle as equilateral, isosceles, or scalene and calculate its area, given the lengths of the three sides. Please enter the lengths of three sides of a triangle. Side 1: 1 Side 2:1 Side 3:1 The triangle is equilateral. The area of the triangle is 0.43 square units. F: Penn State Warrisburg spring 2021\CMPSC 121\lab Projects\tab 5\1.ab_5_solution\Debu O\Lab_5_Solution.exe (process 36172) exited with code 0. Press any key to close this window.. Sample run #2 (User enters 3 invalid lengths.): MediaCom The purpose of this program is to classify a triangle as equilateral, isosceles, or scalene and calculate its area, given the lengths of the three sides. Please enter the lengths of three sides of a triangle. Side 1: 1 Side 2: 2 Side 3: 3 The three lengths you entered do not form a triangle. : Penn State Warrisburg spring 2021\CMPSC 121 ab Projects\lab 51. ab_5_Solution\Debu gexited Press any key to close this window Sample run #3 (User enters 3 valid lengths.): The purpose of this program is to classify a triangle as equilateral, isosceles, or scalene and calculate its area, given the lengths of the three sides. please enter the lengths of three sides of a triangle. Side 1: 5.0 Side 2: 3.0 Side 3: 4.0 The triangle is scalene. The area of the triangle is 6.00 square units. Venn State Warrisburo Spring, 2921\CMPSC 121\tab Projects\Lab 5\Lab_5_solution\Debu exited Press any key to close this window

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions