Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is in c++ Work in groups of two or three students. This lab will support the same input as in Lab #2. You will

image text in transcribedthis is in c++

Work in groups of two or three students. This lab will support the same input as in Lab #2. You will implement a Triangle class according to the header file as given. // Triangle.h #lfndef TRIANGLE H #de fine TRIANGLE H class Triangle i public: Triangle (float base, float height); float area ) private: float base float height #endif /* TRIANGLE H */ Write a program that reads from a data file named triangles.dat in the same directory as your program's current working directory (i.e. no need to specify path to the file) that contains unknown pairs of base and height values of triangles. Use the Triangle objects created from the class above to compute the area. Again, you may use the following values in your data file or you can create your own. cat triangles.dat 15.0 4.0 6.0 9. 3.0 4. 5.23 8.45 52.36 84.78 The area of triangle is calculated with this formula Areabase*height Expected output format s ./lab03 Triangle 1: Triangle 2: Triangle 3: Triangle 4: Triangle 5: b-15, h-4, area-30 b-6, h-9, area-27 b=3, h=4, area-6 b=5.23, h=8.45, area-22.0968 b=52.36, h=84.78, area=2219.54 Note: I will use a different input data file to test your program and the file will contain different number of triangles (including an empty file or missing file), so do not assume there will always be 5 triangles in the file

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

=+2. Are you happy to pay a price premium for CSR products?

Answered: 1 week ago