Advertisement
vencinachev

Vector-Main

Mar 9th, 2021
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1.  
  2. public class Program {
  3.  
  4.     public static void main(String[] args) {
  5.         Vector v1 = new Vector(0, 10);
  6.         System.out.println("Vector v1: " + v1);
  7.         System.out.printf("Magnitude v1: %.2f\n", v1.magnitude());
  8.        
  9.         Vector v2 = new Vector(3, 2);
  10.         v1.add(v2);
  11.         System.out.println("Vector v1 + vector v2: " + v1);
  12.        
  13.         System.out.printf("Magnitude v1 + v2: %.2f\n", v1.magnitude());
  14.     }
  15.  
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement