Last active
May 23, 2021 14:03
-
-
Save amrojjeh/ffc2dc492230f1b7a072c3a86fa0c7a6 to your computer and use it in GitHub Desktop.
Classes Article - No Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main | |
{ | |
public static void main(String[] args) | |
{ | |
// (2, 3) | |
double x1 = 2; | |
double y1 = 3; | |
// (5, 0) | |
double x2 = 5; | |
double y2 = 0; | |
// p1 + p2 | |
double x3 = x1 + x2; | |
double y3 = y1 + y2; | |
String output = String.format("(%.2f, %.2f) + (%.2f, %.2f) = (%.2f, %.2f)", x1, y1, x2, y2, x3, y3); | |
System.out.println(output); | |
// Output: | |
// (2.00, 3.00) + (5.00, 0.00) = (7.00, 3.00) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment