Answered step by step
Verified Expert Solution
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
the
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started