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

Write a definition of a class named Point that might be used to store and manipu

ID: 3566124 • Letter: W

Question

Write a definition of a class named Point that might be used to store and manipulate the location of a point in the plane.

This program should present a menu with the following options. It should accept both upper and lower case letters for the options, and if what is entered is not one of the options it should print 'That is not a valid option' and display the menu again. The options are as follows:

s: set the coordinated of point

m: move a point

r: rotate a point

q: quit

PLEASE read the entire instructions and look at the pictures. This program is different than the others posted on here.

Document these functions with appropriate comments. Embed your class in a test program that behaves as described below. Your program should maintain 3 Point objects that can be modified. You can use an array of point objects preferred) or you can declare three individual Point objects The program should present a menu with the following options. It should accept both upper and lower case tenets for the options. and if what is entered is not one of the options it should print. That is not a valid option and display the menu again. The options are as follows: s: set the coordinates of point in: move a point r: rotate a point q: quit The behavior for each function is described below: s: Ask the user which point they would like to set (l-3). Then ask the user to enter the z and y coordinates, separated by a space. Set the point and print the point number (l-3) followed by the coordinates. in: ask which Point they would like to move. Print the current Point number and its coordinates. Then ask for the number of units to move in the x and y directions, separated by a space. Print the new coordinates of the point r: ask which Point they would like to imitate. Print the current Point number and its current coordinates. Then print the new coordinates of the point q: exit the program The type Point is a fairly simple data type. but under another name (the template class pair) this data type is defined and used in the C++ Standard Template Library. although you need not know anything about the Standard Template Library to do this exercise. Write a definition of a class named Point that might be used to store and manipulate the location of a point in the plane. You will need to declare and implement the following member functions: a. A member function set that sets the private data alter an object of this class is created. b. A member function to move the point by an amount along the vertical and horizontal directions specified by the first and second arguments. c. A member function to rotate the point by 90 degrees clockwise around the origin. d. Two const inspector functions to retrieve the current coordinates of the point. Write a definition of a class named Point that might be used to store and manipulate the location of a point in the plane. This program should present a menu with the following options. It should accept both upper and lower case letters for the options, and if what is entered is not one of the options it should print 'That is not a valid option' and display the menu again. The options are as follows: s: set the coordinated of point m: move a point r: rotate a point q: quit PLEASE read the entire instructions and look at the pictures. This program is different than the others posted on here.

Explanation / Answer

#include <iostream>
#include <cstdlib>

using namespace std;

class Point
{
public:
void initialize(double init_x, double init_y);
void shift(double dx, double dy);
double get_x();
double get_y();
private:
double x;
double y;

};

int main()
{
Point p1;
Point p2;

p1.initialize(-1.0, 0.8);
cout << p1.get_x() << p1.get_y() << endl;
p2.initialize(p1.get_x(),p1.get_y());
cout << p2.get_x() << p2.get_y() << endl;
p2.shift(1.3, -1.4);
cout << p2.get_x() << p2.get_y() << endl;

return 0;
}

void Point::initialize(double init_x, double init_y)
{
x = init_x;
y = init_y;
}



double Point::get_x()
{
return x;
}

void Point::shift(double dx, double dy)
{
x = x - y;
y = x;
}

double Point::gety()

{

return y;

}

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