Clase Pedidos Ejercicio Java - Curso de Programación Java

 Ejercicio

Clase Pedidos

 Objetivo

Con Visual Studio, cree un proyecto y las clases correspondientes (con varios archivos) para este diagrama de clases.

Cada clase debe incluir los atributos y métodos mostrados en el diagrama. Considera que todas las cardinalidades son 1:1.

 Código de Ejemplo

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;
	}

}

Juan A. Ripoll - Tutoriales de Sistemas y Cursos de Programación© 2024 Todos los derechos reservados.  Condiciones legales.