Computer Science Assignment | Custom Assignment Help

Lab 8: Getting on-line stock quotes from Yahoo (with a Socket )

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

This lab is an example of interacting with an HTTP server to retrieve a web page from a system on the network. Here HTML forms are used. HTML forms allow you to type some information in your browser which is sent back to the server for processing. The information may be encoded as part of the URL, or sent separately in name/value pairs.

Custom Assignment Help

The Yahoo site is a wide-ranging access portal. They offer online stock quotes that you can read in your browser. A request for a stock quote for ABCD is translated to a socket connection of:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

That’s equivalent to opening a socket on port 80 of and sending a “get /q?s=abcd”. You can make that same request yourself, in either of two ways. You can open a socket connection to port 80, the http port. Or you can open a URL connection which offers a simpler, higher-level interface, which you did it in lab 7.

The Yahoo page that returns stock quotes contains thousands of characters of href ads and formatting information. It consists of many HTML lines like this:



It is fairly easy to pull out the stock price. From inspecting the output, it’s on a line with more than 25 chars. The line contains the stock symbol rewritten in upper case. The number you want is bracketed by …, which is the HTML to print the number in bold face.

Note: Yahoo site changes each year or once in a while the format of its finance webpage changes. So, you need to figure out what has changed for this assignment and plan your solution accordingly. For 2018, the web site has removed its link for http access as I understand. All sites nowadays use HTTPS (HTTP Secure). I suggest using CNN money site as shown below for trying to find IBM stock price:

So, you need to build your Get command with its query string so that it points to the above URL. And your parsing approach would be different as you will find its stock price in a line like shown below (first occurrence of MorningstarQuote may be one way to catch the string for this price):

Custom Assignment Help


Your Lab 8 assignment is to write a program that uses the  SSLSocket class to create a connection to host and port 443. You provide the symbol for a specific stock in your command line. Your program could apply the getOutputStream() method to the secure socket in order to open an outputStream for writing to the CNN site.

Send the name/value pair (i.e., symb=ibm) in a GET request to the remote host as the CNN site expects. Then read the returned information which is in the format described above. Parse and extract the characters of interest that is the price between =”MorningstarQuote”>124.79

Please study relevant pages of your textbook on chapters 6, 8, and especially chapter 10 and its example 10-1 on HTTPSClient, for methods that you can use for an SSLSocket object or use any other online resource. You probably need to use and familiarize yourself with the following methods:

getOutputStream, and  get input stream

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Homework Writing Services
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Good response.
Customer 454463, May 5th, 2022
Good one.
Customer 453625, May 21st, 2022
I like the work.
Customer 463095, June 22nd, 2022
Customer 463813, March 10th, 2023
Always use AP Style for your headings
Customer 452441, April 11th, 2022
Business and administrative studies
Commendable. Review credentials alignment in APA cover page. Student paper
Customer 453187, March 31st, 2022
Business and administrative studies
Customer 458115, May 16th, 2022
Healthcare & Medical
Customer 463473, November 4th, 2022
Customer 453391, May 8th, 2020
MGMT 221 Introduction to Management Information System
Thank you!
Customer 457731, February 2nd, 2022
Interior Decoration
Excellent work! We look down to your future contribution
Customer 463463, November 16th, 2022
I am pleased with my paper. The support team helping me to receive this finally was phenomenal. Thank you
Customer 453993, February 10th, 2020
Customer reviews in total
Current satisfaction rate
3 pages
Average paper length
Customers referred by a friend
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat