Commit a9768b27 authored by Rohit Prasad's avatar Rohit Prasad

Add constructor to create object with argument of class Order

parent 671505e4
...@@ -20,6 +20,15 @@ public abstract class Order { ...@@ -20,6 +20,15 @@ public abstract class Order {
this.stock = stock; this.stock = stock;
} }
Order(Order o) {
this.qty = o.getQty();
this.price = o.getPrice();
this.c = o.getCustomer();
this.time = o.getTime();
this.type = o.getType();
this.stock = o.getStock();
}
int getQty() { return qty; } int getQty() { return qty; }
float getPrice() { return price; } float getPrice() { return price; }
...@@ -33,7 +42,7 @@ public abstract class Order { ...@@ -33,7 +42,7 @@ public abstract class Order {
Stock getStock() { return stock; } Stock getStock() { return stock; }
void setQty(int qty) { this.qty = qty; } void setQty(int qty) { this.qty = qty; }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
// self check // self check
......
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