C++ Declare a class Box. A box as you all know is something a cubical container. It has following attributes •Length •Width •Height In addition to these, a box can be made of different materials e.g. wood, card, metal etc. Further, more a box can have different colors. Declare them also as member variables of class. Provide a default Constructor, a parameterized Constructor for the Box that takes all necessary values as arguments with the material as optional (if it is omitted the Box is considered to be made of Card – default value for the material. Provide getters for all attributes and setters for each too except for the material (material of box cannot be changed after when it has been created!!!). Provide a function getVolume() that calculates and returns the value of the volume of the Box. Also provide another function getSurfaceArea(),that calculates and returns the surface area of a Box. Provide a print function that Prints the following about the Box Length: Width: Height: Material: Color: Volume: Surface Area: Inside main, allocate a block of memory for 5 objects (using array). Read the necessary values from the user to populate array. Call functions Print() and Volume to display the data of boxes you just have saved in array. Read the index and the new height from the user, ask the user to provide index of the box to change its height by creating a function update(Box b[], int size, int index, double height). Update the height of the Box present on the index provided by user, save the updated height right there, and print it again.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C++ Declare a class Box. A box as you all know is something a cubical container. It
has following attributes •Length
•Width
•Height
In addition to these, a box can be made of different materials e.g. wood, card, metal etc. Further, more a box can have different colors. Declare
them also as member variables of class. Provide a default Constructor, a parameterized Constructor for the Box
that takes all necessary values as arguments with the material as optional
(if it is omitted the Box is considered to be made of Card – default value
for the material. Provide getters for all attributes and setters for each too except for the
material (material of box cannot be changed after when it has been
created!!!). Provide a function getVolume() that calculates and returns the value of
the volume of the Box. Also provide another function getSurfaceArea(),that calculates and
returns the surface area of a Box. Provide a print function that Prints the following about the Box
Length:
Width:
Height:
Material:
Color:
Volume:
Surface Area:
Inside main, allocate a block of memory for 5 objects (using array). Read the necessary values from the user to populate array. Call functions Print() and Volume to display the data of boxes you just
have saved in array. Read the index and the new height from the user, ask the user to
provide index of the box to change its height by creating a function
update(Box b[], int size, int index, double height). Update the height of

the Box present on the index provided by user, save the updated height
right there, and print it again.

Expert Solution
steps

Step by step

Solved in 6 steps with 7 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY