Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

While the file has more data in it: - Read a line of data from the file and store it in a String. Each line

While the file has more data in it: - Read a line of data from the file and store it in a String. Each line in the file contains the bowler's name and three game scores. The line has the format:

lastname, firstname score score score

There is only one space between values. Extract the scores from the String and store them in 3 separate variables. JAVA

This is my code so far. I will attach a file example below my code as an example of what might be on the file. I must be able to extract as many strings that are present in the file, as in data may be added or subtracted. image text in transcribed

Example of file data:

image text in transcribed

import java.util.*; import java.io.*; public class lab5 public static void main (String[] args) throws IOException { String fileName; String inputLine; int lineCount 0; scanner scan new Scanner(System.in); System.out.println("Enter file name: "); fileNamescan.nextLine (); Scanner filesc an = new Scanner (new File(fileName)); while (fileScan.hasNext() inputLine fileScan.nextLine(); //print the line we just got from the file System.out.println(inputLine); //count the input line inecount++ /of while file scan //main //class

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

using signal flow graph

Answered: 1 week ago