forked from FerrisSE/NewSENG210repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
111 lines (81 loc) · 2.36 KB
/
test.java
File metadata and controls
111 lines (81 loc) · 2.36 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//I've made an edit! - Jordan
//Look at the edit. Big wow.
//third commit is the charm
//Hello World
//Much java, very code
//Print out Branch
/*
*
*
*
*
*
*
* I wonder if this will conflict with anything?
*
*
*
*
*
*
*/
// :-)
//Testing Testing
//More Testing
/// adding a new file does not affect anything, is this right?
//Much java, very code
// conflicts can always be resolvedwith patience
//not just pullin and pushin
// I am tryign to create a local divergence here
//Commit 1
//Commit 2
//New feature - Natalie
//Even MORE features! - Natalie
import java.util.ArrayList;
import java.util.Scanner;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
//import java.io.PrintWriter;
public class test {
//Testing DB Branch
//Stuff, Stuff, Stuff!!!!!!!!!
public static void main (String[] args) throws IOException {
FileInputStream fileByteStream = null; // File input stream
FileOutputStream fileStream = null; //File output stream
PrintWriter outFS = null; //File printer
Scanner inFS = null; //Scanner Object
ArrayList<Float> Values = new ArrayList<Float>();
float Sum = 0;
float average;
int i;
int k=9/0;
//Try to open the file
//Add exception handling methods
//try {
fileByteStream = new FileInputStream("avgFile1.txt");
inFS = new Scanner(fileByteStream);
//File is open and valid (otherwise exception thrown)
while(inFS.hasNextFloat()) {
Values.add(inFS.nextFloat()); //adds values to array list
}
for(i=0; i<Values.size();i++) {
Sum = Sum + Values.get(i); //Sums all values
}
average = Sum/(Values.size()); //finds average
fileByteStream.close(); //this is a testing file
fileStream = new FileOutputStream("avgOutput1.txt");
outFS = new PrintWriter(fileStream);
outFS.println("Average: ");
outFS.println(average);
outFS.flush();
System.out.println("Average: ");
System.out.println(average);
fileStream.close();
//}
// catch ( IOException II) {
//System.out.println("djhsjdhfsdjkfhsdjhsdjkhfdj");
// }
}
}
//adding a new commit - june 10th.