Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For C++ -- Create a class Rectangle. Class Rectangle has two private member variables, int length and int width. Class Rectangle has a parametrized constructor

For C++ --

Create a class Rectangle. Class Rectangle has two private member variables, int length and int width. Class Rectangle has a parametrized constructor that accepts two argument for length and width and sets the values of member variables length and width. Class Rectangle has three public member functions, double getlength() that returns length, double getwidth() that returns the width, and double getarea() that returns the area by multiplying length and width.

Class Room has two private member variables, int height and a pointer to class Rectangle *prec. It has a constructor that accepts the arguments for height and pointer to Rectangle class and sets the value of member variables height and prec. Class Room has a public member function getamount(double cost) that accepts the cost of painting per square foot and returns the total amount required to paint the room (ceiling and four walls only),

return (area of ceiling+ 2*length*height + 2*width*height)*cost

Create an object of class Rectangle. Create an object of class Room. Display the amount that is required to paint the room.

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

What do they do well?

Answered: 1 week ago

Question

What is cost plus pricing ?

Answered: 1 week ago

Question

1. What are the types of wastes that reach water bodies ?

Answered: 1 week ago

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago