-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstock.java
executable file
·49 lines (42 loc) · 1.2 KB
/
stock.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
46
47
48
49
public class stock extends Investment
{
/**
* constructor for stock
*/
stock()
{
super();
}
/**
* @param newPrice is price being passed which is being used to calculate bookvalue for Stock
* @param newQuantity is the quantity which is being to calculate bookvalue for Stock
* calculates the bookvalue and changes the bookvalue for stock
*/
@Override
public void calculateBookvalue(float newPrice, int newQuantity)
{
bookvalue = bookvalue + (newPrice * newQuantity ) + 9.99f;
}
/**
* calculates the payment according to the parameters
*/
@Override
public float calculatePayment( float Price, int Quantity)
{
float stockFee = 9.99f;
float payment = 0;
payment = (Price * Quantity) - stockFee;
return payment;
}
/**
* calculates the gain according to the parameters
*/
@Override
public float calculateGain(float Price, int Quantity, float BookValue)
{
float stockFee = 9.99f;
float gain = 0;
gain = ( Price * Quantity) - stockFee - BookValue;
return gain;
}
}