Java program from exercise to include an array of


Question:

Modify the Java program from exercise to include an array of Shareholders. As each Shareholder object is created from the file place it into the array of Shareholders. To test that this process has worked, iterate through the Shareholder array after it has been populated with objects to display the Customer ID and Customer Name of each object.

code:
File inFile = new File("shareholders.txt");
Scanner inputFile = new Scanner(inFile);
String str;
String[] tokens;
while (inputFile.hasNext()) {
str = inputFile.nextLine();
tokens = str.split(",");
for (int i=0; i < tokens.length; i++) {
System.out.println(tokens[i]);
} //end for
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Java program from exercise to include an array of
Reference No:- TGS02538601

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)