#include #include #include #include #include using namespace std; const int xSize{20}; const int ySize{20}; class Point { public: Point(int = 0, int = 0); void setPoint(int &x, int &y); int getXcoor(); int getYcoor(); void plotPoint(); private: int xCoor; int yCoor; }; Point::Point(int x, int y) :xCoor{x}, yCoor{y} { if(x<0 || x>xSize || y<0 || y>ySize) { xCoor=0; yCoor=0; cout << "Invalid input. Defaulting to (0, 0)." << endl; } } void Point::setPoint(int &x, int &y) { if(x<0 || x>xSize || y<0 || y>ySize) { xCoor=0; yCoor=0; } else { xCoor=x; yCoor=y; } } int Point::getXcoor() { return xCoor; } int Point::getYcoor() { return yCoor; } void Point::plotPoint() { for(int j=ySize; j>=0; j--) { cout << setw(2) << j; for(int i=0; i<=xSize; i++) { if(j==yCoor && i==xCoor) cout << "* "; else cout << " "; } cout << endl; } cout << " "; for(int i=0; i<=xSize; i++) cout << setw(2) << i; cout << endl; } int main() { Point pt2{12,4};//Please remove this for exercise 5 pt2.plotPoint();//Please remove this for exercise 5 }