Solution Found!

Write a program that reads a file containing two columns of floating-point num

Chapter 8, Problem P8.4

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Write a program that reads a file containing two columns of floating-point num bers.Prompt the user for the file name. Print the average of each column.

Questions & Answers

QUESTION:

Write a program that reads a file containing two columns of floating-point num bers.Prompt the user for the file name. Print the average of each column.

ANSWER:

Step 1 of 2

If we expect double output, then it's better to parse the numbers to double, not int.

You can use String.split to split the line on white spaces and then parse the doubles:

Add to cart


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back