Class Orders Learn programming C#

Lesson:

OOP Object Oriented Programming


Exercise:

Class Orders


Objetive:

Using Visual Studio, 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.


Code:

using System;
namespace Orders
{
    class Customer
    {
        public Customer() 
        {
            name = "";
            address = "";
        }
        protected string name;
        protected string address;
        protected Order[] o;
    }
}

using System;
namespace Orders
{
    class Item : OrderDetail
    {
        public Item() 
        {
            shippingWeight = "";
            description = "";
        }

        protected string shippingWeight;
        protected string description;

        public double getPriceForQuantity() 
        {
            return 0;
        }

        public double getWeight()
        {
            return 0;
        }

        public string GetShippingWeight()
        {
            return shippingWeight;
        }

        public string GetDescription()
        {
            return description;
        }
        public void SetShippingWeight(string shippingWeight)
        {
            this.shippingWeight = shippingWeight;
        }

        public void SetDescription(string description)
        {
            this.description = description;
        }
    }
}

using System;
namespace Orders
{
    class Order
    {
        public Order() 
        {
            status = "";
        }
        protected DateTime date;
        protected string status;

        protected OrderDetail[] o;

        public double calcTax()
        {
            return 0;
        }

        public double calcTotal()
        {
            return 0;
        }
        public double calcTotalWeight()
        {
            return 0;
        }

        public DateTime GetDate()
        {
            return date;
        }

        public string GetStatus()
        {
            return status;
        }
        public void SetDate(DateTime date)
        {
            this.date = date;
        }

        public void SetStatus(string status)
        {
            this.status = status;
        }
    }
}

using System;
namespace Orders
{
    class OrderDetail
    {
        public OrderDetail() 
        {
            quantity = 0.0;
            taxStatus = "";
        }
        protected Item[] i;
        protected double quantity;
        protected string taxStatus;

        public double calcSubTotal()
        {
            return 0;
        }

        public double calcWeight()
        {
            return 0;
        }

    }
}

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.