Question: C++ Please Create class for each calculation Properties for each value needed Assign user input to appropriate properties Class should contain calculate function using set

C++ Please

Create class for each calculation

Properties for each value needed

Assign user input to appropriate properties

Class should contain calculate function using set properties

Calculate function should output answer to the console.

Code:

#ifndef SHAPES_H_

#define SHAPES_H_

class Triangle {

public: Triangle();

float side1;

float side2;

Triangle(float side1_, float side2_);

float getSide1(float side1_){

return side1;

}

float getSide2(float side2_){

return side2;

}

void setSide1( float side1_){

side1 = side1_;

}

void setSide2( float side2_){

side2 = side2_;

}

private:

float hypotenuse;

};

class Trapezoid {

public: Trapezoid();

float base1;

float base2;

float height;

Trapezoid(float base1_, float base2_, float height_);

float getBase1(float base1_){

return base1;

}

float getBase2(float base_){

return base2;

}

float getHeight(float height_){

return height;

}

void setBase1( float base1_){

base1 = base1_;

}

void setBase2( float base2_){

base2 = base2_;

}

void setHeight (float height_){

height = height_;

}

private:

float hypotenuse;

};

#endif

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!