Java Reference
In-Depth Information
bank accounts in an array list. Write a readFile method of the Bank
class for reading a file with the format
accountNumber1 balance1
accountNumber2 balance2
. . .
Implement read methods for the Bank and BankAccount classes.
Write a sample program to read in a file with bank accounts, then print
the account with the highest balance. If the file is not properly formatted,
give the user a chance to select another file.
Additional programming exercises are available in WileyPLUS.
PROGRAMMING PROJECTS
΢΢΢ Project 11.1. You can read the contents of a web page with this
sequence of commands.
String address =
"http://java.sun.com/index.html";
URL u = new URL(address);
URLConnection connection = u.openConnection();
InputStream stream = connection.getInputStream();
Scanner in = new Scanner(stream);
. . .
Some of these methods may throw exceptionsȌcheck out the API
documentation. Design a class LinkFinder that finds all hyperlinks of
the form
<a href="link">link text</a>
Throw an exception if you find a malformed hyperlink. Extra credit if
your program can follow the links that it finds and find links in those
web pages as well. (This is the method that search engines such as
Google use to find web sites.)
526
Search WWH ::




Custom Search