Write the code for a constructor of class CargoShip. The tonnage should be set to 54000,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the code for a constructor of class CargoShip. The tonnage should be set to 54000, the speed should be set to 0, and the fuel should be set to 2000000. Then a for loop should allocate memory to 10 BoxContainer Objects and add them to the vector cargo. Part 2: Write the code for a destructor of class CargoShip. The destructor should deallocate the memory from the vector cargo. Given: class BoxContainer ( }; int inventory; string contents; class CargoShip ( private: int tonnage; double speed; double fuel; vector <BoxContainer"> cargo; public:: //Needs Constructor //Needs Destructor Write the code for a constructor of class CargoShip. The tonnage should be set to 54000, the speed should be set to 0, and the fuel should be set to 2000000. Then a for loop should allocate memory to 10 BoxContainer Objects and add them to the vector cargo. Part 2: Write the code for a destructor of class CargoShip. The destructor should deallocate the memory from the vector cargo. Given: class BoxContainer ( }; int inventory; string contents; class CargoShip ( private: int tonnage; double speed; double fuel; vector <BoxContainer"> cargo; public:: //Needs Constructor //Needs Destructor
Expert Answer:
Answer rating: 100% (QA)
The task provided outlines the requirements for constructing and destructing a CargoShip class as we... View the full answer
Related Book For
Digital Systems Design Using Verilog
ISBN: 978-1285051079
1st edition
Authors: Charles Roth, Lizy K. John, Byeong Kil Lee
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Visual Studio c++ Make sure it runs and add a picture of the console screen and comments Objective: Pointers Templates Question 1a: Implement a class called myVector that stores integers in it. You...
-
According to the Statute of Frauds, in order to be legally enforceable, a contract must be in writing, name the contracting parties, identify the subject matter of the contract, and Be for a legal...
-
On April 1, 10,000 shares of $20 par common stock were issued at $24. Illustrate the effects on the accounts and the financial statements
-
A manufacturer has fixed costs of $200 each week, and the variable costs per unit can be expressed by the function, VC = 2Q 36. (a) Find an expression for the total cost function and deduce that the...
-
Derive the stiffness and mass matrices of a uniform beam element in transverse vibration rotating at an angular velocity of \(\Omega \mathrm{rad} / \mathrm{s}\) about a vertical axis as shown in Fig....
-
Georgia Shacks produces small outdoor buildings. The company began operations in 2010, producing 2,000 buildings and selling 1,500. A variable costing income statement for 2010 follows. During the...
-
Explore the impacts of the Coronavirus, the war in Ukraine, and other recent events and policies on supply and demand dynamics. Find articles using the sources listed below to identify fluctuations...
-
How would the Highest interest rate to the Lowest credit card payment method apply a $1200 payment to a card with an outstanding balance of $2000 broken down as follows: Transaction Rate Balance...
-
a. A corporate bond has been issued on January 1, 2005, that will mature on January 1. 2025. The annual coupon payment rate is 5% and has a par value of RM1,000. If Pluto Berhad plans to buy the bond...
-
In your view, what are the positive and negative consequences of globalization?
-
Which of the problems in the construction of the CPI might be illustrated by each of the following situations? Explain. a. The increase in streaming films. b. The introduction of air bags in cars. c....
-
Look up the following comovements for the country in which you are studying on an appropriate website. Explain whether the comovements are procyclical or countercyclical; GDP and: a. inflation b....
-
What is the doomsday model (neo-Malthusian approach)? How does it differ from the logic-ofgrowth model?
-
How are descent groups associated with tribal religious practices?
-
10. Regulating a natural monopoly Consider the local telephone company, a natural monopoly. The following graph shows the demand curve for phone services, the company's marginal revenue curve...
-
The Ferris wheel in the figure has a radius of 68 feet. The clearance between the wheel and the ground is 14 feet. The rectangular coordinate system shown has its origin on the ground directly below...
-
Write a task that has an integer signal and a file name as parameters. Each line of the file contains a delay value and an integer. The task reads a line from the file, waits for the delay time,...
-
Write a Verilog module that describes a 16-bit serial-in, serial-out shift register with inputs SI (serial input), EN (enable), CK (clock, shifts on rising edge), and a serial output (SO).
-
Given the following timing waveform for Y, draw D and E. wire #4 D; // net delay on wire D assign #6 D = Y; // statement 1 2 inertial delay wire #6 E; // net delay on wire E assign #4 E = Y; //...
-
3 kg of oxygen undergoes a non-flow process during which its pressure remains constant at 7 bar from an initial volume of 1200 litres to a state where the temperature is \(520 \mathrm{~K}\). Find...
-
0.5 kg of air is compressed reversibly and adiabatically from \(80 \mathrm{kPa}, 60^{\circ} \mathrm{C}\) to \(0.4 \mathrm{MPa}\), and is then expanded at constant pressure to the original volume....
-
A constant volume chamber of \(0.3 \mathrm{~m}^{3}\) capacity contains \(2 \mathrm{~kg}\) of a gas at \(5^{\circ} \mathrm{C}\). Heat is transferred to the gas until the temperature is \(100^{\circ}...
Study smarter with the SolutionInn App