Skip to content

Instantly share code, notes, and snippets.

@amrojjeh
Last active May 23, 2021 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amrojjeh/ffc2dc492230f1b7a072c3a86fa0c7a6 to your computer and use it in GitHub Desktop.
Save amrojjeh/ffc2dc492230f1b7a072c3a86fa0c7a6 to your computer and use it in GitHub Desktop.
Classes Article - No Class
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