Question: Programming Language = Java The question: How do I make this code that I have, while(lineScan.hasNext(){ not scan numbers on the txt file. I only

Programming Language = Java

The question: How do I make this code that I have, while(lineScan.hasNext(){ not scan numbers on the txt file. I only want to scan the river names - the txt file is attached as well. I need to store the river names in the river index array

lineScan.next() is scanning the numbers on the txt file, so instead of it being over after scanning the Strings, it keeps going and scans all the integers before going to the next line.

lineScan.nextInt() isn't scanning the numbers as integers at allProgramming Language = Java The question: How do I make this code

This is the txt File - you can copy paste it to a text document

35 Angelina River 26 22 18 22 20 24 19 23 21 22 18 19 Blanco River 25 21 22 21 21 19 19 20 22 21 23 22 Bosque River 16 21 23 22 26 20 20 20 20 20 21 23 Brazos River 19 20 22 15 19 20 17 21 24 21 22 18 Canadian River 21 21 20 18 19 22 19 20 25 24 20 16 Colorado River 20 19 19 15 22 18 24 17 20 19 18 21 Concho River 16 21 19 18 17 17 26 21 19 23 19 22 Guadalupe River 22 23 15 23 20 18 18 18 20 17 18 20 James River 16 21 27 16 17 16 21 24 18 18 21 21 Lampasas River 22 15 15 19 19 19 20 21 21 17 21 27 Lavaca River 20 15 15 19 25 14 19 15 27 20 15 22 Leon River 22 19 26 21 20 21 21 20 26 23 24 21 Little River 19 17 18 15 24 21 22 23 21 13 23 27 Llano River 18 19 23 20 21 18 20 20 19 20 20 23 Navidad River 19 18 25 21 22 24 21 20 20 23 21 20 Neches River 20 15 21 17 18 23 22 23 21 18 22 21 Nolan River 23 21 18 18 18 23 21 21 25 21 22 17 Nueces River 19 20 20 23 20 20 22 23 18 19 19 26 Paluxy River 23 21 24 20 22 22 16 16 23 22 18 18 Pease River 17 16 21 21 21 19 23 23 19 22 20 18 Pedernales River 27 15 20 19 20 19 21 26 19 17 24 22 Prairie Dog Town Fork Red River 23 20 22 23 19 19 20 20 24 16 24 18 Red River 20 19 19 18 22 25 22 15 19 20 22 21 Rio Grande 23 21 20 17 20 25 19 21 21 24 19 23 Sabine River 24 17 25 17 26 20 24 22 21 18 24 21 San Antonio River 16 21 20 20 21 23 17 18 21 26 20 21 San Bernard River 21 22 24 20 21 21 24 22 19 23 18 22 San Gabriel River 23 18 21 18 15 12 22 26 19 22 21 17 San Jacinto River 18 22 21 20 22 18 19 22 29 19 21 19 San Marcos River 16 18 19 16 21 18 19 15 21 22 19 23 San Saba River 23 21 19 20 26 21 25 20 18 25 17 14 Sulphur River 23 17 22 19 17 19 19 23 19 19 24 20 Trinity River 22 23 21 19 19 19 17 20 23 17 20 18 White River 21 21 20 20 13 20 21 19 24 20 17 25 Wichita River 24 21 17 21 22 23 17 18 24 22 20 23

public class PollutionDataManager implements PollutionDataManager Interface{ public static void main(String[] args) throws FileNotFoundException { String riverNameCheck; int rivIndex = 0; String riverName = ""; String riverIndex[] = {"1","2", "3", "4", "5", "6","7","8","9","10", "11", "12","13", "14","15", "16", "17","18","19", "20" "21","22","23","24","25", "26", "27","28","29","30","31", "32","33","34","35","36","37"}; Scanner newCountScan = new Scanner(new File( pathname: "countFile.txt")); Scanner newDataScan = new Scanner(new File( pathname: "newDatafile.txt")); String line = newCountScan.nextLine(); Scanner lineScan = new Scanner(line); while(line Scan.hasNextLine()){ while(line Scan. hasNext(){ river Name = riverName + lineScan.next() + } Array.set(riverIndex, index: 1, river Name); rivIndex++; System.out.println(riverIndex[1])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!