I am learn Algorithms, 4th Edition with IntelliJ IDEA, however, I encouted a issue that the IDEA told me "Cannot resolve symbol 'StdIn' and 'StdOut'".
Pic: [Cannot resolve symbol "StdIn"](http: //i.imgur.com/ZRD6o53.jpg)
My project structure is correct and I set stdlib.jar
as one of the dependencies, where there are StdIn and StdOut. Even I clicked "Invaildate caches and restart" the issue remains.
You may learn the details of stdlib.jar
from here and Average.java
public class Average {
// this class should not be instantiated
private Average() { }
/**
* Reads in a sequence of real numbers from standard input and prints
* out their average to standard output.
*/
public static void main(String[] args) {
int count = 0; // number input values
double sum = 0.0; // sum of input values
// read data and compute statistics
while (!StdIn.isEmpty()) {
double value = StdIn.readDouble();
sum += value;
count++;
}
// compute the average
double average = sum / count;
// print results
StdOut.println("Average is " + average);
}
}