+ 9
Can anyone correct this code?
3 Answers
+ 2
You need to use Scanner instead of DataInputStream. You can find information about it in the SoloLearn Java course
+ 2
+ 1
Two issues
issue 1: DataInputStream Br = new DataInputStream(System.in);
Incorrect way to get input, if you want to use inputstream change this into
BufferedReader Br = new BufferedReader(new InputStreamReader(System.in));
issue 2: perc = sum/500*100; (did you mean to divide by 400)
unless this comes out to a whole number it will convert into 0
Remove int perc from line 5 and create it as a double instead