Exercise
Class Orders
Objetive
Create a project and the corresponding classes (using several files) for this classes diagram.
Each class must include the attributes and methods shown in the diagram. Consider that all cardinalities are 1:1.
Example Code
package Orders;
public class Customer
{
public Customer()
{
name = "";
address = "";
}
protected String name;
protected String address;
protected Order[] o;
}
package Orders;
public class Item extends OrderDetail
{
public Item()
{
shippingWeight = "";
description = "";
}
protected String shippingWeight;
protected String description;
public final double getPriceForQuantity()
{
return 0;
}
public final double getWeight()
{
return 0;
}
public final String GetShippingWeight()
{
return shippingWeight;
}
public final String GetDescription()
{
return description;
}
public final void SetShippingWeight(String shippingWeight)
{
this.shippingWeight = shippingWeight;
}
public final void SetDescription(String description)
{
this.description = description;
}
}
package Orders;
public class Order
{
public Order()
{
status = "";
}
protected java.time.LocalDateTime date = java.time.LocalDateTime.MIN;
protected String status;
protected OrderDetail[] o;
public final double calcTax()
{
return 0;
}
public final double calcTotal()
{
return 0;
}
public final double calcTotalWeight()
{
return 0;
}
public final java.time.LocalDateTime GetDate()
{
return date;
}
public final String GetStatus()
{
return status;
}
public final void SetDate(java.time.LocalDateTime date)
{
this.date = date;
}
public final void SetStatus(String status)
{
this.status = status;
}
}
package Orders;
public class OrderDetail
{
public OrderDetail()
{
quantity = 0.0;
taxStatus = "";
}
protected Item[] i;
protected double quantity;
protected String taxStatus;
public final double calcSubTotal()
{
return 0;
}
public final double calcWeight()
{
return 0;
}
}