1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
SOVA2 [1]
3 years ago
9

Create a class called MyBoxes with: - 1 instance variable, and array to hold Box objects - a constructor with 1 parameter - the

size of the array -- the constructor will create the array and set it to the size of the parameter - a method called emptyspace with no parameters -- the method returns how many elements of the array are null - a method called add with 3 parameters --- the method takes length, width and height as paremeters --- the method creates a Box object and adds it to the array if there is space left - a method called print with no parameters --- the method loops through the array and prints each element that is not null
Computers and Technology
1 answer:
Veseljchak [2.6K]3 years ago
4 0

Answer:

C++

Explanation:

class MyBoxes {

   private:

       // Pointer to Box object and array size. Required for dynamically creating an array.

       Box* boxes;

       int array_size;

       // Constructor

       MyBoxes(int array_size) {

           self.array_size = array_size;

           boxes = new Box[array_size] ;

       }

   public:

       // Methods

       int emptyspace() {

           int count = 0;

           for (int i=0; i < self.array_size; i++) {

               // Check for null

               if (!boxes[i])

                   count++;

           }

           return count;

       }

       void add(int length, int width, int height) {

           Box box1(length, width, height);

           if (self.emptyspace() == 0)  {

               self.addToArray(box1);

           }

       }

       void print() {

           Box *temporaryBox;

           for (int i=0; i < self.array_size; i++) {

               temporaryBox = boxes[i];

               if (temporaryBox) {

                   cout<<temporaryBox->length<<endl;

                   cout<<temporaryBox->width<<endl;

                   cout<<temporaryBox->height<<endl;

               }

           }

           // Free memory

           delete temporaryBox;  

       }

You might be interested in
When we insert a new node into a red-black tree, we set the color of the newly inserted node n to red. observe that if we had ch
Vika [28.1K]
Cause u didnt want to
4 0
4 years ago
Can some one help sorry I just so confused on this and I keep failing it I just need the help So choose the best answers
statuscvo [17]

Answer:

i7tyerged

Explanation:

7 0
4 years ago
What term describes what an actor breaks when he addresses the audience directly from stage, like in Hamlet’s “to be or not to b
Dmitriy789 [7]
Breaking of the third wall.
if you were to be an actor on a stage and directly ask the audience a question, or making a statement that you as a character acknowledge that the character knows it is a play.
5 0
3 years ago
Read 2 more answers
Image files are grouped into two categories: _____.
EleoNora [17]
It is grouped according to raster and vector format. Raster format are images used in a computer or printed. Vector format stores data and is compressed. 

Examples of common raster formats usually used in a computer are; jpeg, png, bitmap, and gif. Vector formats are; CGM, SVG and 3D vector.
4 0
4 years ago
Describe Mr. Digby, the principal. ​
Gennadij [26K]

Answer:

stinky

Explanation:

7 0
4 years ago
Other questions:
  • Why is it important to not get distracted while driving?
    13·2 answers
  • A signal has a spectrum from 0 to 145 Hz, as shown below. It is sampled at a rate of 295 Hz. Find the region of the baseband spe
    5·2 answers
  • If you cause a car accident, which type of insurance will require you to pay the least out of pocket?
    5·2 answers
  • Urgent ..algorithm and flowchart to check weather a number is odd or even ???​
    8·2 answers
  • 2. Which Interface uses
    7·1 answer
  • Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
    6·1 answer
  • Write a method doubleUp that doubles the size of a list of integers by doubling-up each element in the list. Assume there's enou
    13·1 answer
  • What programming language does the LMC 'understand'?
    5·1 answer
  • Do you guys answer questions about cyber security?
    10·1 answer
  • _____ allows a function or operator to perform different tasks depending on the types of the arguments or operands. Group of ans
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!