Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Describe your ideal working day.

Answered: 1 week ago