Skip to content
Advertisement

Doing sums with data read from file in Java

I am fairly new to Java and have come across an issue which I know should be fairly easy to resolve. However, I cannot figure out where I am going wrong and how I can go about solving this issue. As you can see from my code snippet below I am trying reading from a file using the classical FileReader and I have used a while loop to read the entire file. However, this works all well and good but I would like to multiply the read.nextint() with read.nextdouble() However when I try and multiply them where my Income is it throws an error message. Any solution would be great! Thanks.

JavaScript

This is the error message:

JavaScript

This is the data I am trying to read from the file

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement