-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStock.java
More file actions
48 lines (42 loc) · 1.26 KB
/
Stock.java
File metadata and controls
48 lines (42 loc) · 1.26 KB
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
package com.company;
public class Stock{
String ticker;
String type;
final double open,high, low, close;
Stock(String ticker, String type, double open, double high, double low, double close){
this.ticker = ticker;
this.type = type;
this.open = open;
this.high = high;
this.low = low;
this.close = close;
}
public String getTicker(){
return ticker;
} //returning value of scrip
public void setTicker(String ticker){
this.ticker = ticker;
} //setting scrip
public String getType(){
return type;
} //returning sector
public void setType(String type){
this.type = type;
} //setting sector
public double getOpen(){
return open;
} //returning value of open price
public double getHigh(){
return high;
} //returning value of high price
public double getLow(){
return low;
} //returning value of low price
public double getClose(){
return close;
} //returning value of close price
@Override
public String toString() {
return String.format("scrip: "+ticker+", sector: "+type+", O:"+open+", H:"+high+", L:"+low+", C:"+close);
}
}