Professional Documents
Culture Documents
KOM3550 Object Oriented Programming Assignment 3
KOM3550 Object Oriented Programming Assignment 3
Name:
Number:
int getSize();
// return the size of the array
int* getData();
// a pointer to the elements of the array is returned
void fill(const int value);
//fill the array with a constant value
void print();
//display the array information
private:
int* data;
int size;
};
----------------------------------------------------------
// test_Array.cpp
Array a1; // a1 ← {0}
Array a2(5, 0); // a2 ← {0, 0, 0, 0, 0}
int arr[]={3,3,3,3,3};
Array a3(5, arr); // a3 ← {3, 3, 3, 3, 3}
2 KOM3550 Object Oriented Programming Assignment 3
a2.add(a3); // a2 ← {3, 3, 3, 3, 3}
a2.subtract(a3); // a2 ← {0, 0, 0, 0, 0}
a2.fill(1); // a2 ← {1, 1, 1, 1, 1}
a2.multiply(a3); // a2 ← {3, 3, 3, 3, 3}
cout << a3.product(a4)<<endl; // 45
a2.copy(a3); // a2 ← {3, 3, 3, 3, 3}
a2.fill(1); // a2 ← {1, 1, 1, 1, 1}
a2.print(); // [1 1 1 1 1]
...
Pi pi2(2);
pi1.print();
cout << pi1.apprErr()
Submit your files for the codes, and screen images for your runs in one zipped folder.
A suitable name for the folder can be YourNumber_YourName_KOM3550_Assignment3.{zip/rar}.
a. The due date is firm. The files should be submitted by the end of the due date.
b. Submit your documents via e-mail to programming.kom@gmail.com