Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named Square. Define a getter and setter for it. Define a function to calculate the area. create 5 different objects (sq1, saq2,sq3,sq4

Create a class named Square.

Define a getter and setter for it.

Define a function to calculate the area.

create 5 different objects (sq1, saq2,sq3,sq4 and sq5).

For each square display its side and the area.

// classes example #include

using namespace std;

class Square {

int side;

public:

void setside(int s)

{

side = s;

}

int getside()

{

return side;

}

};

int main() {

Square sq1;

sq1.setside(10);

cout << "area: " << sq1.getside();

return 0;

}

HELP!

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago