Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Change the Program into C++: class Point { private int x; private int y ; ......... // add any needed methods public void printPoint( )

Change the Program into C++:
class Point {
private int x;
private int y ;
......... // add any needed methods
public void printPoint( ) { . }
public void shiftPoint(int h, int k) { }
}
class Set {
private Point[ ] p;
public Set (int n) {
p = new Point [n];
}
.. // add any needed methods
public void readSet( ) { . }
public void printSet( ) { . }
public void shiftSet(int h, int k) { }
}
Write the SetTest class such that it starts with constructing a set (of n points, n is to be read from user). The program then reads the points in the set (by calling readSet( )).
Then the program works as a menu-driven with these options:
1- Print the Set
2- Shift the Set
3- Exit
Sample Run:
Enter how many points: 3
Enter 3 points:
3 5 7 3 11 8
Menu: 1- Print 2- Shift 3- Exit
Enter Choice: 1
{ (3 , 5) , ( 7 , 3) , ( 11 , 8) }
Menu: 1- Print 2- Shift 3- Exit
Enter Choice: 2
Enter the shift values in x and y directions: 5 1
Shift Done
Menu: 1- Print 2- Shift 3- Exit
Enter Choice: 1
{ (8 , 6) , ( 12 , 4) , ( 16 , 9) }
Menu: 1- Print 2- Shift 3- Exit
Enter Choice: 3
Program ended, Good Bye.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions