Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA, ALSO MAKE A METHOD USING SCANNER TO READ THE FILE, MAKE THE CODE SIMPLE SO I CAN FOLLOW PLEASE, THANKS The client will

IN JAVA, ALSO MAKE A METHOD USING SCANNER TO READ THE FILE, MAKE THE CODE SIMPLE SO I CAN FOLLOW PLEASE, THANKS

The client will provide data of a gas jockey in the form of a text file. The name of the file is input.txt. Each line of this file indicates fueling records of a vehicle in a certain week. Each number in a line indicates gallons of gas pumped into the vehicle. A line may contain arbitrary number of double precision quantity. The number of vehicles is arbitrary too. Assume that only those vehicles that were fueled at least once will appear in the input text file. Your program should read the data from the file into a 2-dimensional array, where each row will keep records of fueling for a vehicle. Compute and print out the following information:

How many total gallons of gas were pumped into each vehicle?

What is the average amount of gas pumped during a fueling for each vehicle? What is the average gas amount pumped during the first, second, third, , and nth fueling of the week? n represents the maximum of the number of times each vehicle was fueled.

What is the maximum amount of gas pumped into each vehicle in a week? What is the minimum amount of gas pumped into each vehicle in a week? Your program must have separate methods for reading in the data and for printing each of the different quantities given above.

Please do not just put all of your code into the main method. From the main method, you should call all the methods.

Example input file (in a week when the gas jockey pumped six vehicles):

20.0 10.0

4.5 8.45 12.0 8.0

8.0

4.1 15.2 18 20.1

7.0 14.0 17.5

6.75 9.20 10.0 9.0 15.5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

=+3. What are market presence strategies, and which can you name?

Answered: 1 week ago