So I am supposed to (1) declare an array of 5 objects of type Box, (2) call a function to load the user input into each object
Rupert Crane, an employee with SpaceMiser Logistics, has hired you to write a program that will help
him decide whether a certain packing layout meets the company's requirements for efficiency. Below
is the data for a shipment of 5 boxes with which you can test your program.
Box 1: 0,0 0,5 14,5 14,0 Height: 5
Box 2: 0,5 0,10 5,10 5,5 Height: 5
Box 3: 5,5 5,10 10,10, 10,5 Height: 5
Box 4: 10,7 10,8 13,8 13,7 Height: 3
Box 5: 10,5 10,7 15,7 15,5 Height: 4
Can someone show me how I could design a function to take in the appropriate coordinate data? And then how i can call different functions to act on the data from those 5 boxes? Also Having trouble instantiating the object... Im so lost. I appreciate your time and help. I apologize for not having that much written in the code but truthfully ive restarted the assignment twice after trying painfully complex combinations of code, so this is my third try trying to keep it simple:
Here is the what i have so far including the template:
#include <iostream>
usingnamespace std;
//------------------------------------------------------------------------------
class Box
{
public:
Box(int h=10, int w=10, int d=0)
{
height = h;
width = w;
depth = d;
}
~Box();
//Member Methods
int getMaxX();
int getMaxY();
int getMinX();
int getMinY();
int getVolume();
void setData();
int h, w, d;
//Accessor methods
int getHeight(){ return height;}
void setHeight(int x) {height = x;}
int getWidth(){ return width;}
void setWidth(int x){ width = x;}
int getDepth(){ return depth;}
void setDepth(int x){ depth = x;}
string getBoxName(){return BoxName;}
void setBoxName(string x){BoxName = x;}
private:
int height, width, depth;
string BoxName;
};
int main()
{
cout << "\n\tWelcome to CLASSES! In main().";
//stack
int x = 30;
double y = 20.15;
Box BoxA;
BoxA.setWidth(5);
BoxA.setHeight(5);
BoxA.setDepth(5);
BoxA.setBoxName("Box A");
//the HEAP (Free Store)
Box * BoxB = new Box();
BoxB->setWidth(10);
BoxB->setHeight(10);
BoxB->setDepth(10);
BoxB->setBoxName("Box B");
//declare an array of 5 objects of type Box
//call a function to load the user input into each object
//call a function to print results for part #1 and #2
//call a function to print results for part #3
//print the results for part #4
}
//------------------------------------------------------------------------------
/*
Results go here!
*/
*/