Class Box Logistics Assignment w/Coords

Hello everyone,

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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>

using namespace 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!

*/

*/
Topic archived. No new replies allowed.