package hw1; import java.io.*; import java.util.*; import java.net.*; import java.awt.*; public class Main { static final String qURL="http://quote.yahoo.com/q?s=msft&d=v1"; static final float numShares = (float)2.48; static final long quoteInterval = 1000; public static void main(String args[]) throws MalformedURLException, IOException, InterruptedException { DisplayMarketCap w = new DisplayMarketCap( "Market Cap"); w.show(); while (true) { // Sleep for some time Thread.sleep(quoteInterval); // Get Quote Information URL url = new URL(qURL); URLConnection connection = url.openConnection(); float quote = GetQuoteInfo.getQuoteFromURL(connection); // Display the market cap in a window w.setContents(quote*numShares); System.out.println(quote*numShares); } } }