-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathFund.java
More file actions
44 lines (39 loc) · 953 Bytes
/
Fund.java
File metadata and controls
44 lines (39 loc) · 953 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
package u012;
import java.sql.SQLOutput;
/**
* Created by HuGuodong on 11/23/19.
*/
public class Fund implements IInvestment{
private String fundName;
private Stock stock1;
private Stock stock2;
private Stock stock3;
private RealState realState;
public NationalDebt nationalDebt;
public Fund(String fundName){
this.fundName = fundName;
stock1 = new Stock("GOL");
stock2 = new Stock("APL");
stock3 = new Stock("AAL");
realState = new RealState("WANDA");
nationalDebt = new NationalDebt("debt 5% interests per year");
}
@Override
public void buy() {
System.out.println("Fund Buy Operation: " + fundName);
stock1.buy();
stock2.buy();
stock3.buy();
realState.buy();
nationalDebt.buy();
}
@Override
public void sell() {
System.out.println("Fund Sell Operation");
stock1.sell();
stock2.sell();
stock3.sell();
realState.sell();
nationalDebt.sell();
}
}