By implementing the concepts of Classes and Objects, write a C++ program that determines the distance between 2 points in a coordinate system. The coordinates of the 2 points: P1 (x1, y1) and P2(x2, y2) are to be entered from the keyboard. The distance, d, between the 2 points is computed as : d= V(2 – y1)² + (x2 – x1)² Accomplish the following for the given class diagram: Point 1.) Create the class implementation using C++ x: int 2.) Using the constructor, create 2 objects, P1 and P2, from y: int class Point and store them in the heap memory. + Point( x : int, y : int ) + setXY(): void + getX( ) : int + getY( ) : int 3.) Implement the functions of the 2 objects. NOTE: The member function setXY is used to enter the values of x and y from the keyboard. Sample input/output display: Enter the coordinates of the 1* point (x1 y1): 1 1 Enter the coordinates of the 2nd point (x2 y2): 5 4 The distance, d, between P(1,1) and P(5,4) = 5
By implementing the concepts of Classes and Objects, write a C++ program that determines the distance between 2 points in a coordinate system. The coordinates of the 2 points: P1 (x1, y1) and P2(x2, y2) are to be entered from the keyboard. The distance, d, between the 2 points is computed as : d= V(2 – y1)² + (x2 – x1)² Accomplish the following for the given class diagram: Point 1.) Create the class implementation using C++ x: int 2.) Using the constructor, create 2 objects, P1 and P2, from y: int class Point and store them in the heap memory. + Point( x : int, y : int ) + setXY(): void + getX( ) : int + getY( ) : int 3.) Implement the functions of the 2 objects. NOTE: The member function setXY is used to enter the values of x and y from the keyboard. Sample input/output display: Enter the coordinates of the 1* point (x1 y1): 1 1 Enter the coordinates of the 2nd point (x2 y2): 5 4 The distance, d, between P(1,1) and P(5,4) = 5
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Using C++, show the code for this problem
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
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.Recommended textbooks for you
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
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