Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ 200 ICA 2-6 X Y C++ triangle x C++ - Triang x C++ - Triang X Area of the X wnloads/200%20ICA%202-6-20.pdf For your ICA
c++
200 ICA 2-6 X Y C++ triangle x C++ - Triang x C++ - Triang X Area of the X wnloads/200%20ICA%202-6-20.pdf For your ICA today you will be designing a Right Triangle class and an application program that uses the class. Formulas: Hypotenuse: c = a +6 Perimeter: P = a+b+Va+b? ASUS ZenBook Formulas: Hypotenuse: c=a +6 Area: A =- Perimeter: P = a+b+V a'+b? -20.pdf arch 200 ICA 2-6 X Y C++ triangle x C++ - Triang x C++ - Triang X Area of the X wnloads/200%20ICA%202-6-20.pdf For your ICA today you will be designing a Right Triangle class and an application program that uses the class. Formulas: Hypotenuse: c = a +6 Perimeter: P = a+b+Va+b? ASUS ZenBook Hidily C++ - Triang X Area of th 201CA%202-6-20.pdf Your Right Triangle class will consist of the following: Variables: - a leg (type double) for the a leg of the night triangle b_leg (type double) for the b_leg of the right triangle Constructors/Functions A constructor that takes no arguments. This constructor will initialize both a leg and b_leg to 0.0000001. You can initialize a leg and b_leg either in the member initializer list or in the body of the constructor A constructor that takes two arguments, one for the a leg value and one for the bleg value, and initializes the a_leg and b_leg member variables from these values. Tiput validation if the a leg and/or bleg values passed to the constructor are not greater than do, then set the a leg and/or b_leg member variables to 8.800081. Otherwise, set the leg and/orb leg member variables to the values passed to the constructor You can validate the input either by checking it directly in the body of the constructor, or by having this constructor call the set_a_leg and set_b_leg functions, as these functions will validate the input for a leg and b leg respectively (see below) A function named set a leg, which sets a leg member variable with the value passed to the function: Input validation if the a leg value passed to the function is not greater than zero, then set the a leg member variable to acceei. Otherwise, set the aller member variable to the value passed to the function. A function named set_b leg, which sets b_leg member variable with the value passed to the function: Input validation if the a leg value passed to the function is not greater than zero, then set the b_leg member variable to 8.0000001. Otherwise, set the les member variable to the value passed to the function. A function named get a leg, which returns the value of the a lex member variable. A function named get b leg, which returns the value of the bleg member variable. A function named get cler, which calculates the value of the eleg (hypotenuse) using the formula shown above and returns this value. A function named get area, which calculates the value of the area using the formula shown above and returns this value. H ! DICA%202-6-20.pdf A function named get perimeter, which calculates the value of the perimeter using the formula shown above and returns this value. Application Program: In your application program you will be creating two Right Triangle objects. The first RT object that you create will call the no-argument constructor, which will initialize the a leg and bleg member variables to e.0800001, and then print out the results by calling the appropriate get member functions from the class (see below). To create tlas second RT object, you need to first prompt the user to enter the inputs for a leg and b_leg, and then create the object using the two-argument constructor, and then print out the results by calling the appropriate get member functions from the class (see below). NOTES: - There is no cleg member variable, because the value of the cleg (hypotenuse) is calculated from the values of a leg and b_leg. For this same reason, there is no set. Jeg member function. - You should submit two files: a header file (.h file) with your class code for the Right Triangle class, and a source file (.cpp file) with the application program (.e., main). You can name these files
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started