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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter5: Making Decisions
Section: Chapter Questions
Problem 7PE
icon
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,