-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntro.java
More file actions
52 lines (27 loc) · 1005 Bytes
/
Intro.java
File metadata and controls
52 lines (27 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//testing the ability to take a given file and read the HTML-embedded code
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.util.Scanner;
public class Intro {
public static void main(String[] args) throws IOException {
System.out.println("Input a stock symbol. For example: GOOG, AMZN, TWTR : ");
Scanner scan = new Scanner(System.in);
String sym = scan.nextLine();
URL url = new URL("https://finance.yahoo.com/quote/" + sym + "?p=" + sym + "&.tsrc=fin-srch");
URLConnection uc = url.openConnection();
InputStreamReader inStream = new InputStreamReader(uc.getInputStream());
BufferedReader b = new BufferedReader(inStream);
String l = b.readLine();
while(l!=null) {
System.out.println(l); {
l = b.readLine();
}
}
}
}
/*
general idea
1. be able to input a desired share price value
2. be recommended stocks to buy based upon percent change
*/