-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInteg.java
47 lines (42 loc) · 894 Bytes
/
Integ.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
/**
* Creates an integer that can be manipulated. This was needed becuase the
* normal int was not allowed to be used in a lambda expression.
*
* @author: Ryan Wong
* @version 1.0
*/
public class Integ
{
// instance variables - replace the example below with your own
int s;
/**
* Constructs an integer with an intial value of 0.
*/
public Integ()
{
s = 0;
}
/**
* Constructs an integer with an intial value that the user gives.
*/
public Integ(int n) {
s = n;
}
/**
* Sets the score to the new score.
* @param int newS
*/
public void setValue(int newS) {
s = newS;
}
/**
* Returns the value of the integer.
* @return int s
*/
public int getValue() {
return s;
}
public void changeValue(int n) {
s += n;
}
}