Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with modifying the code below. // ClassListOps.cpp : Defines the ent

ID: 3639071 • Letter: I

Question

I need help with modifying the code below. // 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; }

I need help with modifying the code below. // 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

// ClassListOps.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
using namespace std;
/*
* MAIN
*/
int main()
{
//
// Box should handle any primitive
Box aSum, bSum;
for( int i = 0; i < 5; i++ )
{
//
// Modify the class to use "aSum[i] = (i*6);"
aSum.add(i*7);
bSum.add(i*7);
}
//
// 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( 2, -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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote