Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++ -----------image text in transcribed

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

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

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions