Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Write a class called rectangle It should have two dimensions and one area as variables (all integers and private) It should also have three

image text in transcribed

1) Write a class called "rectangle" It should have two dimensions and one area as variables (all integers and private) It should also have three member functions as set(), get() and draw(). a) set() will simply set the dimensions of the rectangle (as two arguments supplied to the function), and also calculate the area and set it. b) draw() will draw the rectangle on the screen with characters if the dimensions are less than 80 by 20 (width x height), otherwise a message will be displayed as Not Possible to Draw". c) get() function simply returns the value of variable which holds the area. 2) Write a main function to exercise the operation. Create an object called myrectangle ask the user (in main) to enter dimensions and set the dimensions using set function and then draw this rectangle, also show area on screen

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