Question: c++ ----------- Question 01 Create a class, Triangle, with the following private attributes: base (float) and height (float) The class has public set and get

c++ -----------c++ ----------- Question 01 Create a class, Triangle, with the following private

Question 01 Create a class, Triangle, with the following private attributes: base (float) and height (float) The class has public set and get methods as well as a public method computeArea) that returns the triangle's area (base * height / 2.0) Write a main program that creates either a vector or an array to hold 5 instances of Triangle. Use a for loop to ask the user for base and height dimensions for each instance and store in the object's appropriate attributes Write a max function, passing the vector or array as a parameter, to determine which object has the greatest area, returning the index number of that object. Finally, write to the console the base, height, and area of all triangles, each on a separate line. All numbers are to be displayed to two decimal places. Put a comment after the largest one to indicate it is largest. You must use separate source files for each main, max, and class Triangle. Sample output: 2.00 x 4.00 has area 4.00 1.00 x 6.00 has area 3.00 2.50 x 4.25 has area 5.31 - largest 4.00 x 0.05 has area 0.01 0.99 x 0.99 has area 0.49

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!