-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEquity.java
More file actions
33 lines (25 loc) · 1.03 KB
/
Equity.java
File metadata and controls
33 lines (25 loc) · 1.03 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
/* Jay Jayewardene. A class that represents equity which is an asset where one can own shares of
* the asset */
public class Equity extends Asset {
private String name; //stores the name of the equity asset
private char symbol; //stores the character symbol of the equity asset
private double numberShares; //stores the number of asset shares of the equity asset
/* A constructor that sets the name, symbol, and current price of an equity */
public Equity(String name, char symbol, double currentPrice){
super(name, 0);
this.symbol = symbol;
this.currentPrice = currentPrice;
}
/* Get the symbol of the equity */
public char getSymbol(){
return symbol;
}
/* Get the number of shares of the equity */
public double getNumberShares(){
return numberShares;
}
/* Change the number of shares of equity */
protected void setNumberShares(double numberShares){
this.numberShares = numberShares;
}
}