-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSineLine.java
49 lines (43 loc) · 882 Bytes
/
SineLine.java
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
47
48
49
/*
* Written by Noah Shaw
*/
public class SineLine implements Line {
//Instance variables
private double amplitude;
private double frequency;
//Constructors
public SineLine()
{
this.amplitude = 0.0;
this.frequency = 0.0;
}
public SineLine(double aAmplitude, double aFrequency)
{
this.setAmplitude(aAmplitude);
this.setFrequency(aFrequency);
}
//Accessors
public double getAmplitude()
{
return this.amplitude;
}
public double getFrequency()
{
return this.frequency;
}
//Mutators
public void setAmplitude(double aAmplitude)
{
this.amplitude = aAmplitude;
}
public void setFrequency(double aFrequency)
{
this.frequency = aFrequency;
}
//Methods
public double getYPoint(double aXCoord)
{
double yCoord = this.amplitude * Math.sin(aXCoord * this.frequency);
return yCoord;
}
}