Complete a \"Box\" class for the code attached / ClassListOps.cpp : Defines the
ID: 3639141 • Letter: C
Question
Complete a "Box" class for the code attached / ClassListOps.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; /* * MAIN */ int main() { // // Box should handle any primitive Box<int> aSum, bSum; for( int i = 0; i < 5; i++ ) { // // Modify the class to use "aSum[i] = (i*6);" aSum.add(i*6); bSum.add(i*6); } // // compare the two objects directly if( aSum == bSum ) cout << "they have the same sum" << endl; // // see modify the call to use "bSum[3] = -1" bSum.chgValue( 3, -1 ); if( !( aSum == bSum ) ) cout << "they have different sums " << endl; // // implement the "<" logical bSum.add(9); if( (aSum < bSum) ) cout << "a < b" << endl; return 0; }Complete a "Box" class for the code attached / ClassListOps.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; /* * MAIN */ int main() { // // Box should handle any primitive Box<int> aSum, bSum; for( int i = 0; i < 5; i++ ) { // // Modify the class to use "aSum[i] = (i*6);" aSum.add(i*6); bSum.add(i*6); } // // compare the two objects directly if( aSum == bSum ) cout << "they have the same sum" << endl; // // see modify the call to use "bSum[3] = -1" bSum.chgValue( 3, -1 ); if( !( aSum == bSum ) ) cout << "they have different sums " << endl; // // implement the "<" logical bSum.add(9); if( (aSum < bSum) ) cout << "a < b" << endl; return 0; }
Explanation / Answer
#include using namespace std; // Class to represent a box class Box { public: double length; double breadth; double height; // Inline initialization Box(double lv = 1.0, double bv = 1.0, double hv = 1.0):length(lv), breadth(bv), height(hv) { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.