Question: In C++ create the following header file ////Main File////////////// #include #include #include #include using namespace std; using namespace teaching_project; // Place stand-alone function in unnamed

In C++ create the following header fileIn C++ create the following header file ////Main File////////////// #include #include #include

////Main File//////////////

#include

#include #include #include using namespace std; using namespace teaching_project;

// Place stand-alone function in unnamed namespace. namespace { void TestPart1() { Points2 a, b; // Two empty Points2 are created. cout

void TestPart2() { Points2 a, b; cout

} // namespace

int main(int argc, char **argv) { TestPart1(); TestPart2(); return 0; } ////////end main file//////////////////////////

///////point2 class///////////////

ifndef CSCI335_HOMEWORK1_POINTS2_H_ #define CSCI335_HOMEWORK1_POINTS2_H_ #include  #include  #include  #include  #include  namespace teaching_project { // Place comments that provide a brief explanation of the class, // and its sample usage. template class Points2 { public: // Default "big five" -- you have to alter them for your assignment. // That means that you will remove the "= default" statement. // and you will provide an implementation. // Zero-parameter constructor. // Set size to 0. Points2() = default; // Copy-constructor. Points2(const Points2 &rhs) = default; // Copy-assignment. If you have already written // the copy-constructor and the move-constructor // you can just use: // { // Points2 copy = rhs; // std::swap(*this, copy); // return *this; // } Points2& operator=(const Points2 &rhs) = default; // Move-constructor. Points2(Points2 &&rhs) = default; // Move-assignment. // Just use std::swap() for all variables. Points2& operator=(Points2 &&rhs) = default; ~Points2() = default; // End of big-five. // One parameter constructor. Points2(const std::array& item) { // Provide code. } // Read a chain from standard input. void ReadPoints2() { // Part of code included (without error checking). std::string input_line; std::getline(std::cin, input_line); std::stringstream input_stream(input_line); if (input_line.empty()) return; // Read size of sequence (an integer). int size_of_sequence; input_stream >> size_of_sequence; // Allocate space for sequence. // Add code here. Object token; for (int i = 0 ;input_stream >> token; ++i) { // Read coordinates. // Fill sequence_ here. } } size_t size() const { // Code missing. } // @location: an index to a location in the sequence. // @returns the point at @location. // const version. // abort() if out-of-range. const std::array& operator[](size_t location) const { // Code missing. } // @c1: A sequence. // @c2: A second sequence. // @return their sum. If the sequences are not of the same size, append the // result with the remaining part of the larger sequence. friend Points2 operator+(const Points2 &c1, const Points2 &c2) { // Code missing. } // Overloading the  *sequence_; // Size of sequence. size_t size_; }; } // namespace teaching_project #endif // CSCI_335_HOMEWORK1_POINTS2_H_ 

///////////end point2 class////////////////////

Overload the + and [] operators for your Points2 class. Test with the following code. The code is already provided for you in the main file. You can comment parts of it as you are testing your implementation. For full credit all functions should work. void TestPart20 { Points2 a, b; cout d=a +b; cout a, b; cout d=a +b; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!