Skip to content
Snippets Groups Projects
Commit e9d88a79 authored by augustrb's avatar augustrb
Browse files

Added getters, setters and add and subtract functions

parent 14c9a332
No related branches found
No related tags found
1 merge request!1Added getters, setters and add and subtract functions
package edu.ntnu.stud; package edu.ntnu.stud;
public class Vector2D { public class Vector2D {
private double x0;
private double x1;
public Vector2D(double x0, double x1) {
this.x0 = x0;
this.x1 = x1;
}
public double getX0() {
return x0;
}
public double getX1() {
return x1;
}
public void setX0(double x0) {
this.x0 = x0;
}
public void setX1(double x1) {
this.x1 = x1;
}
public void add(Vector2D v) {
x0 += v.x0;
x1 += v.x1;
}
public void subtract(Vector2D v) {
x0 -= v.x0;
x1 -= v.x1;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment