forked from Zipcoder/BlueJ.SumOfInput
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSumOfInput.java
More file actions
32 lines (28 loc) · 693 Bytes
/
Copy pathSumOfInput.java
File metadata and controls
32 lines (28 loc) · 693 Bytes
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
/**
* Write a description of class SumOfInput here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SumOfInput
{
// instance variables - replace the example below with your own
private Integer sum;
/**
* Constructor for objects of class SumOfInput
*/
public SumOfInput()
{
// initialise instance variables
sum = 0;
}
public Integer oneToNumber(Integer numberToSum){
// numberToSum is the value that should be used to loop to find the sum
sum = 0;
for (int i = 1 ; i <= numberToSum ; i++)
{
sum = sum + i;
}
return sum;
}
}