Hello everyone,
I cant quite make out what my issue is. Ive looked at some of the other questions raised about this problem. I still cant quite make it out. Your assistance is greatly appreciated. Mike
package com.codegym.task.task18.task1817;
/*
Spaces
*/
import java.io.FileInputStream;
import java.io.IOException;
public class Solution {
public static void main(String[] args) throws IOException {
String fileName = args[0];
FileInputStream inStream = new FileInputStream(fileName);
int n1 = 0;
int n2 = 0;
while(inStream.available() > 0){
int data = inStream.read();
if (data == 32)
n2++;
else
n1++;
}
inStream.close();
double result = (double) (n2/n1)*100;
System.out.println(Math.round(result*100.0)/100.0);
}
}