Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The starter code is provided, and the input file is named p2.txt. IN JAVA please the txt in p2.txt is below: 6767 iron man 670000000.98

The starter code is provided, and the input file is named p2.txt. IN JAVA please

the txt in p2.txt is below:

6767 iron man 670000000.98 565 black panter 787008.98 768565 hulk 56566.56 343 spider man 787.90

image text in transcribedimage text in transcribedimage text in transcribedthe

The input file consists of a number of records consisting of an account number, name and balance arated by tabs. Write a program that 1. reads this file into an string array list 2. prints the total number of records 3. repeatedly ask user to enter a line number between 1 and n, where n is the number of lines from the file, 4. checks if the line number is between 1 and n, prompts user otherwise to reenter 5. display the record on that line 6. quits if the user enters 1 In your program write and use the following method returns the record at nth line input: file2-1.txt . You must download this file, save it in the files subfolder in the project folder and provide this filename to the Scanner in the starter code. // add your code here to store the file contents // close scanner in.close(); // print total number of records // to read user's input Scanner in2 = new Scanner(System.in); // add your code here for user input // and to display the corresponding line // exit when input is - 1 while(in2.hasNextint())\{ int n= in2.nextint(); in2.close()

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

Students also viewed these Databases questions

Question

3-13 Analyze Amazon.com and Walmart using the

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago