-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXpLevels.java
More file actions
42 lines (36 loc) · 1007 Bytes
/
XpLevels.java
File metadata and controls
42 lines (36 loc) · 1007 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
33
34
35
36
37
38
39
40
41
42
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package my.quarker;
import java.io.*;
import java.util.LinkedList;
/**
*
* @author ehoward
*/
public class XpLevels {
public LinkedList<Integer> levels = new LinkedList<Integer>();
public XpLevels() {
int x = 0;
for (int i = 1; i < 50; i++) {
x += (i * i * i) + 15; //xp formula
levels.add((Integer) x);
}
}
public void pushObject(BufferedReader reader) {
String currentString = "";
levels.clear();
try {
currentString = reader.readLine();
while (!currentString.equalsIgnoreCase("")) {
levels.add(Integer.valueOf(currentString));
currentString = reader.readLine();
}
} catch (IOException ioe) {
System.out.println("Fatal error reading from file!");
ioe.printStackTrace();
return;
}
}
}