-
Notifications
You must be signed in to change notification settings - Fork 0
/
MutualFund.java
executable file
·45 lines (41 loc) · 1.1 KB
/
MutualFund.java
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
package ePortfolio;
import java.util.*;
/**
* MutualFund subclass of Investment class
*/
public class MutualFund extends Investment{
/**
* Constant selling fee of $45
*/
public static final double FEE = 45.0; //selling fee
//Constructors
/**
* Constructor for creating a MutualFund object
* @param symbol
* @param name
* @param quantity
* @param price
*/
public MutualFund(String symbol, String name, int quantity, double price) {
//from Investment class
super(symbol, name, price, quantity);
//Update bookValue and price
bookValue += (quantity * getPrice());
quantity += quantity;
}
/**
* Constructor for creating a MutualFund object from input file
* @param inputFile
* @throws Exception if file is invalid
*/
public MutualFund(Scanner inputFile){
super(inputFile);
}
/**
* toString method for MutualFund
*/
@Override
public String toString() {
return "\tType: Mutual Fund " + super.toString();
}
}