Question
The class Point stores the location of the origin as static values ORIGIN_X and ORIGIN_Y. It provides public functions to access those values. Add code
The class Point stores the location of the origin as static values ORIGIN_X and ORIGIN_Y. It provides public functions to access those values. Add code to main to call the static functions to print out the X and Y location of the Origin with a space between them. Do NOT try to make any point objects - call the functions directly on the class. Yes, I know you can cheat on this one by just printing "0 0"... figure out how to do it for real We are defining all the code inside the class declaration. This only works for simple one file projects like this one. Do not do this in assignments.
#include
using namespace std;
class Point { public: static double getOriginXValue() { return ORIGIN_X; } static double getOriginYValue() { return ORIGIN_Y; }
private: Point() {} //private so you can't use it double x; double y;
static const double ORIGIN_X; static const double ORIGIN_Y; };
const double Point::ORIGIN_X = 0; const double Point::ORIGIN_Y = 0;
int main() {
//Do not modify anything on or above the line below this //YOUR_CODE_BELOW //YOUR_CODE_ABOVE //Do not modify anything on or below the line above this
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started