Monday, 25 December 2017
ADT: Cuboids
Cuboids are three-dimensional shapes having different measurements in each dimension say height, width and depth. Cuboids
shapes are often used for boxes, cupboards, rooms, buildings, etc. So keeping in the mind the importance of Cuboids you have to
implement a class Cuboids having following functionalities
1. The class should have following three private data members to which value should only be assigned to them when it is
greater than 0 and lesser than 35.00, 1 otherwise no matter to which dimension.
1. A float named height that holds the cuboids’ height.
2. A float named width that holds the cuboids’ width.
3. A float named depth that holds the cuboids’ depth.
2. Provide the implementation of mutators for all the data members (width, height and depth) of the class.
3. Provide the implementation of accessors for all the data members (width, height and depth) of the class.
4. Provide the implementation of following constructors and a destructor
1. A constructor that accepts cuboids’ height, width and depth as arguments and assigns them to the appropriate member
variables.
2. A constructor that accepts cuboids’ height and width as arguments and assigns them to the appropriate member
variables. The depth field should be assigned the default value.
3. A default constructor that initializes all the data members of the class with default values.
4. A copy constructor to initialize a cuboids’ object with already existing object.
5. A destructor that do nothing except displaying a simple message “Destructor executed…” on the screen.
5. Provide the implementation of following member functions
1. setCuboids method accepts cuboids’ height, width and depth as arguments and assigns them to the appropriate
member variables.
2. getCuboids method to initialize the data of a cuboids taken from the user.
3. putCuboids method to display the information of a particular cuboids.
4. getSurfaceArea method provide the facility to calculate the surface area of a cuboids that is
2(height * widht) + 2(height * depth) + 2(width * depth)
5. getVolume method provide the facility to calculate the volume of a cuboids that is height * width * depth
6. getSpaceDiagonal method provide the facility to calculate the space diagonal of a cuboids that is
ℎ ℎ + ℎ + ℎ
7. putCuboidsInfo method should display all the dimensions, surface area, volume and space diagonal of a cuboids.
6. Once you have written the class, write main function and test its functionality by creating some objects of Cuboids.
code Link is...
https://www.dropbox.com/s/ae0abd03lyt3hrg/ADT_Cuboids.cpp?dl=0
Subscribe to:
Post Comments (Atom)
ADT: RationalNumber
Define a class for rational numbers. A rational number is “ratio-nal” number, composed of two integers with division indicated. The division...
-
Design a class called NumDays. The class’s purpose is to store a value that represents a number of work hours and convert it to a number of ...
-
Define a class for rational numbers. A rational number is “ratio-nal” number, composed of two integers with division indicated. The division...
-
LCM is most early technique that is taught in school. it helps us in Calculation of Fractions. here I have written code for finding LCM of ...
No comments:
Post a Comment