Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 RT.h and _app.cpp. For example, if your name is John Smith then your files would be named John Smith RT.h and John_Smith_app.cpp. Your app.cpp application program file needs to include your RT.h header file. You can only upload one file per attempt for the ICA quiz, but the ICA quiz has unlimited attempts. This means that you will need to upload one of your files, submit the quiz, and then go back into the quiz a second time, upload the second file, and then submit the quiz again. Sample Runs: D: Spring 20201200 SPRING 20201 200 2-5-20 ICA\Debug 2002-6-20 ICA.SE RT object 1 a leg value: 0.0000001000, RT object 1 b_leg value: 0.0000001000 RT object 1 c leg value: 0.0000001414 RT object 1 area: 0.0000000000 RT object 1 perimeter: 0.0000003414, Enter the a_leg value for RT object 2: 2, Enter the b_leg value for RT object 2: RT object 2 a_leg value: 2.0000000000 RT object 2 b_leg value: 3.0000000000 RT object 2 c_leg value: 3.6055512755 RT object 2 area: 3.0000000000 RT object 2 perimeter: 8.6055512755 Press any key to continue ... o te AB D: Spring 2020 200 SPRING 2020 200 2-6-20 ICA\Debug 200 2-6-20 ICA.exe RT object 1 a_leg value: 0.0000001000 RT object 1 bleg value: 0.0000001000, RT object 1 c_leg value: 0.0000001414, RT object 1 area: 0.0000000000 RT object 1 perimeter: 0.0000003414 Enter the a_leg value for RT object 2: 5.5 Enter the b_leg value for RT object 2: 12.2 RT object 2 a_leg value: 5.5000000000 RT object 2 b_leg value: 12.2000000000 RT object 2 cleg value: 13.3824511955 RT object 2 area: 33.5500000000 RT object 2 perimeter: 31.0824511955 Press any key to continue

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

Students also viewed these Databases questions

Question

In what kind of situations is Queuing analysis is most appropriate?

Answered: 1 week ago