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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started