Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: In this assignment, you are asked to write the definition for a triangle class and test it with the test program provided. The description

image text in transcribed
Question: In this assignment, you are asked to write the definition for a triangle class and test it with the test program provided. The description of the rectangle class and the driver program are given on the attached file triangle.cpp. Download triangle.cpp and without removing or changing any of the member functions or member variables of this class, complete 9 member function bodies such that your program produces exact output as provided. You should keep the class definition and the main function in the same source file, and you are not allowed to use global variables. Do not add any new member functions. Member Functions: triangle(int base, int hypotenuse); sets base a and hypotenuse c triangle0; initializes base to 3 and hypotenuse to 5 void setBas void setHypotenuse(int newHypotenuse); lets user change hypotenuse to a different number int getBase0 const; returns base a int getHypotenuse) const; returns hypotenuse c void printTriangle0; prints the lengths of each side of the triangle a, b, and c double getArea0; returns the area of the triangle double getPerimeter0; returns the perimeter of the triangle e(int newBase); lets user change base to a different number HINT: to find the height of the triangle, you must solve the Pythagorean theorem for b b sqrt(pow(c, 2)- pow(a, 2))] Area: R 1/2 a b Perimeter: Pa+b+c Pythagorean Theorem: a 2+ b2c2

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

More Books

Students also viewed these Databases questions

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago