Lab 2 -- Java Exceptions and I/O

Java Exceptions and I/O

  1. Work through Sun's Working with URLs tutorial, paying particular attention to the use of input streams in the lesson Reading Directly from a URL.
  2. Yahoo!Finance offers a stock quotation service (15-20 mins delayed) that provides a variety of financial data. The data provided can be controlled directly through the URL, e.g. http://finance.yahoo.com/d/quotes.csv?s=YHOO+IBM&f=snd1l1cvx&e=.csv delivers a CSV (Comma Separated Values) file containing information about Yahoo and IBM stocks, in the following format:
    
     Symbol, Name, Last Trade Date, Last Trade, Change and Change %, Volume, Exchange 
     
    
    
    Write a Java program that allows the user to identify a stock symbol and displays financial data in the format above for the given symbol. Extend your program to allow the user to create a portfolio of stocks and display information accordingly. The web page http://dirk.eddelbuettel.com/code/yahooquote.html provides a summary of the available fields and the associated query format symbols, if you are interested in developing your program further.

Note

Write all your programs using exception handling and create test conditions to exercise the exception handling code.