package ru kpfu itis group11402 batyrova Task058 import ru kpfu itis g

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ru.kpfu.itis.group11402.batyrova.Task058;
import ru.kpfu.itis.group11402.batyrova.Task057.RationalComplexNumber;
/**
* @author Elvira Batyrova
* 402
* 058
*/
public class RationalComplexVector2D {
private RationalComplexNumber x;
private RationalComplexNumber y;
public RationalComplexNumber getX() {
return x;
}
public void setX(RationalComplexNumber x) {
this.x = x;
}
public RationalComplexNumber getY() {
return y;
}
public void setY(RationalComplexNumber y) {
this.y = y;
}
public RationalComplexVector2D() {
this(new RationalComplexNumber(), new RationalComplexNumber());
}
public RationalComplexVector2D(RationalComplexNumber x, RationalComplexNumber y) {
this.x = x;
this.y = y;
}
public RationalComplexVector2D add(RationalComplexVector2D rcv) {
return new RationalComplexVector2D(x.add(rcv.getX()), y.add(rcv.getY()));
}
public String toString() {
return ("(" + x.toString() + ", " + y.toString() + ")");
}
public RationalComplexNumber scalarProduct(RationalComplexVector2D rcv) {
return this.x.mult(rcv.getX()).add(this.y.mult(rcv.getY()));
}
}