THIS NEEDS TO BE DONE IN C#!! Create a class called Coordinate, which will store the x and y coordinates of a point. Create the following operations for this class: X and Y properties for accessing/modifying the coordinates. constructor - allows the user to pass in an initial x and y coordinate. operator+ - overload the + operation to add 2 coordinates together. To add two coordinates together: (x1, y1) + (x2, y2) = (x1 + x2, y1 + y2) Example: (3, 4) + (2, 4) = (5, 8) ToString - Output the coordinates as followed: (X, Y) In main, create two coordinates based on the example above. Print them out using ToString. Create a third coordinate that is the result of the two coordinates added. Print it out as well.
THIS NEEDS TO BE DONE IN C#!! Create a class called Coordinate, which will store the x and y coordinates of a point. Create the following operations for this class: X and Y properties for accessing/modifying the coordinates. constructor - allows the user to pass in an initial x and y coordinate. operator+ - overload the + operation to add 2 coordinates together. To add two coordinates together: (x1, y1) + (x2, y2) = (x1 + x2, y1 + y2) Example: (3, 4) + (2, 4) = (5, 8) ToString - Output the coordinates as followed: (X, Y) In main, create two coordinates based on the example above. Print them out using ToString. Create a third coordinate that is the result of the two coordinates added. Print it out as well.
Chapter5: Making Decisions
Section: Chapter Questions
Problem 7PE
Related questions
Question
THIS NEEDS TO BE DONE IN C#!!
Create a class called Coordinate, which will store the x and y coordinates of a point. Create the following operations for this class:
-
- X and Y properties for accessing/modifying the coordinates.
- constructor - allows the user to pass in an initial x and y coordinate.
- operator+ - overload the + operation to add 2 coordinates together. To add two coordinates together:
- (x1, y1) + (x2, y2) = (x1 + x2, y1 + y2)
- Example: (3, 4) + (2, 4) = (5, 8)
- ToString - Output the coordinates as followed:
- (X, Y)
In main, create two coordinates based on the example above. Print them out using ToString. Create a third coordinate that is the result of the two coordinates added. Print it out as well.
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 now
This is a popular solution!
Step by step
Solved in 3 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
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,