Commit 0a5d53d0 authored by Rohit Prasad's avatar Rohit Prasad

Add stock attribute

parent 2a3c885e
public class BuyTrade extends Trade { public class BuyTrade extends Trade {
BuyTrade(int time, Customer c, int qty, float price) { BuyTrade(int time, Customer c, Stock stock, int qty, float price) {
super(time, "BUY", c, qty, price); super(time, "BUY", c, stock, qty, price);
} }
} }
public class SellTrade extends Trade { public class SellTrade extends Trade {
SellTrade(int time, Customer c, int qty, float price) { SellTrade(int time, Customer c, Stock stock, int qty, float price) {
super(time, "SELL", c, qty, price); super(time, "SELL", c, stock, qty, price);
} }
} }
...@@ -4,13 +4,15 @@ public abstract class Trade { ...@@ -4,13 +4,15 @@ public abstract class Trade {
int time; int time;
String type; String type;
Customer c; Customer c;
Stock stock;
Trade(int time, String type, Customer c, int qty, float price) { Trade(int time, String type, Customer c, Stock stock, int qty, float price) {
this.qty = qty; this.qty = qty;
this.price = price; this.price = price;
this.c = c; this.c = c;
this.time = time; this.time = time;
this.type = type; this.type = type;
this.stock = stock;
} }
int getQty() { return qty; } int getQty() { return qty; }
...@@ -22,4 +24,6 @@ public abstract class Trade { ...@@ -22,4 +24,6 @@ public abstract class Trade {
String getType() { return type; } String getType() { return type; }
Customer getCustomer() { return c; } Customer getCustomer() { return c; }
Stock getStock() { return stock; }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment