Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write/create a program in C++ that follows the following guide lines: (please explain in notation what each line does for/in the code) //Design and code

Write/create a program in C++ that follows the following guide lines: (please explain in notation what each line does for/in the code)

//Design and code a class Furniture.A furniture is anything like a desk, a bed, a table, //...etc.Every furniture has a height, can have a number of legs, can have a number of drawers, //type of wood used to build it(eg.cherry, ash, oak, ...etc), the maker of the furniture and the year it was built.

//Design a default constructor as well as a constructor that accepts values for all variables.

//Your class should implement getters and setters to all the above member variables.

//A method Furniture resize(double factor) that will accept a double and returns an object Furniture resized by the factor. //So far, the method should multiply only the height by the factor. if the factor is negative or 0, you should display an error.

//Overload operators << and >> to display all attributes of a Furniture object and to input values from the user.

//Overload post fix operator ++ to return the original object(this) and the height of the of the object(this) //should be increased by one inch.

//Overload prefix to decrease the height of the object by one inch but not lower than 0, then return the object or a copy.

//Overload operator * between a Furniture object and a double that would do the same as the resize method. //Overload both cases to be able to perform : Furniture = double* Furniture and

//Furniture = Furniture * double.The height should be positive at all times.

//Derive a class Desk from Furniture that implements a desk and knowing that a desk has in addition //a length and a width and it has one drawer and four legs and its length can only be between 24 and 60 inches, //and the width between 16 and 30 inches and the height between 28 and 32 inches. //Display error messages if inputs dont fall within these measurements.

//Provide all getters, setters and constructors that you deem necessary.

//Override the method resize to return a Desk object with the length, //width and height all multiplied by the input factor.Desk resize(double factor);

//Overload operators << and >> to display all the attributes of a Desk object and to input values from the user.

//Overload post fix operator ++ to return the original object(this) while the height, the length, //the width and the number of legs of the of the object(this) are all increased by one.

//Overload prefix to decrease the height, the length and the width of the object by one inch but not lower than 0, //then return the object or a copy.

//Overload operator * between a Desk object and a double that would do the same as the resize method. //Overload both cases to be able to perform : Desk = double* Desk and

//Desk = Desk * double.The height should be positive at all times.

//Test both classes and all methods and overloaded operators, //make sure to use at least one reference to a Furniture object.

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

3. Notice that a - ,j2 Answered: 1 week ago

Answered: 1 week ago