
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%
Need help with the c++ problem

Transcribed Image Text:Question:
1. Implement a class Point and all required functions to make the following main function compile. The
class should have two integer data members x and y and demonstrate proper use of encapsulation, const
member functions, static members, and constructor syntax.
Your solution should work with this main function to produce output matching the example below.
int main() {
std::cout << std::endl;
Point pl;
Point p2 (3, 5);
pl.setx (5);
pl.sety (10) ;
print (pl);
print (p2);
std::cout << Point::getNumPoints () << std::endl;
std::cout << std::endl;
return 0;
Example Output
5,10
3,5
2
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
c++ overloading problem
![Questions:
1. Why were 5 number of point objects created in this program?
2. Implement a class Point and all functions that are required to make the following main function compile
and produce the example output below.
The Point class should have two integer data members x and y and demonstrate proper use of
encapsulation, const member functions, static members, constructor, and overload syntax.
int main() {
std::cout << std::endl;
Point pl;
Point p2 (3, 5);
std::cout << "Enter x and y values:
std::cin>> pl;
std::cout << p1 << " " << -p2 << std::endl;
std::cout << (p1+p2) << std::endl;
std::cout << (p2++) << std::endl;
std::cout << p2 << std::endl;
std::cout << (p1 == p2) << std::endl;
std::cout << p1[0] << " " << p1[1] << std::endl;
std::cout << Point::getNumPoints () << std::endl;
std::cout << std::endl;
return 0;
Example Output
Enter x and y values: 10 20
10 20 -3 -5
13 25
35
46
0
20 10
5](https://content.bartleby.com/qna-images/question/ee344c66-7efa-4594-9121-d91385396bb3/c03248d8-8263-4404-9a8a-f86336a14ff2/pcou2lu_thumbnail.png)
Transcribed Image Text:Questions:
1. Why were 5 number of point objects created in this program?
2. Implement a class Point and all functions that are required to make the following main function compile
and produce the example output below.
The Point class should have two integer data members x and y and demonstrate proper use of
encapsulation, const member functions, static members, constructor, and overload syntax.
int main() {
std::cout << std::endl;
Point pl;
Point p2 (3, 5);
std::cout << "Enter x and y values:
std::cin>> pl;
std::cout << p1 << " " << -p2 << std::endl;
std::cout << (p1+p2) << std::endl;
std::cout << (p2++) << std::endl;
std::cout << p2 << std::endl;
std::cout << (p1 == p2) << std::endl;
std::cout << p1[0] << " " << p1[1] << std::endl;
std::cout << Point::getNumPoints () << std::endl;
std::cout << std::endl;
return 0;
Example Output
Enter x and y values: 10 20
10 20 -3 -5
13 25
35
46
0
20 10
5
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
c++ overloading problem
![Questions:
1. Why were 5 number of point objects created in this program?
2. Implement a class Point and all functions that are required to make the following main function compile
and produce the example output below.
The Point class should have two integer data members x and y and demonstrate proper use of
encapsulation, const member functions, static members, constructor, and overload syntax.
int main() {
std::cout << std::endl;
Point pl;
Point p2 (3, 5);
std::cout << "Enter x and y values:
std::cin>> pl;
std::cout << p1 << " " << -p2 << std::endl;
std::cout << (p1+p2) << std::endl;
std::cout << (p2++) << std::endl;
std::cout << p2 << std::endl;
std::cout << (p1 == p2) << std::endl;
std::cout << p1[0] << " " << p1[1] << std::endl;
std::cout << Point::getNumPoints () << std::endl;
std::cout << std::endl;
return 0;
Example Output
Enter x and y values: 10 20
10 20 -3 -5
13 25
35
46
0
20 10
5](https://content.bartleby.com/qna-images/question/ee344c66-7efa-4594-9121-d91385396bb3/c03248d8-8263-4404-9a8a-f86336a14ff2/pcou2lu_thumbnail.png)
Transcribed Image Text:Questions:
1. Why were 5 number of point objects created in this program?
2. Implement a class Point and all functions that are required to make the following main function compile
and produce the example output below.
The Point class should have two integer data members x and y and demonstrate proper use of
encapsulation, const member functions, static members, constructor, and overload syntax.
int main() {
std::cout << std::endl;
Point pl;
Point p2 (3, 5);
std::cout << "Enter x and y values:
std::cin>> pl;
std::cout << p1 << " " << -p2 << std::endl;
std::cout << (p1+p2) << std::endl;
std::cout << (p2++) << std::endl;
std::cout << p2 << std::endl;
std::cout << (p1 == p2) << std::endl;
std::cout << p1[0] << " " << p1[1] << std::endl;
std::cout << Point::getNumPoints () << std::endl;
std::cout << std::endl;
return 0;
Example Output
Enter x and y values: 10 20
10 20 -3 -5
13 25
35
46
0
20 10
5
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- List three uses of the * symbol in C++.arrow_forwardNeed help with C++ Question.arrow_forwardYou are a member of a standardization committee for a new C++ standard, and there is a proposal on the table to drop C-strings from the language and support only the C++ string class. State whether you would oppose or support the proposal and explain why.arrow_forward
- Hi, I am having difficulty finding words to better explain these questions for my homework. 1. What is a reference in C++? 2. What is a pointer in C++? 3. What is the difference between a pointer and a reference in C++?arrow_forwardPlease us c++ to make the code thank you very much!arrow_forwardHow can you print out anything in C++ without cout?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education