Tutorial C# Sharp - Learn to program with performing exercises C# Sharp

Tutorial C# Sharp

Learn to program with performing exercises C# Sharp

Orders - Tutorial C# Sharp
Tutorial C# Sharp4,85581245

Orders - Tutorial C# Sharp


Lesson 6:

Object oriented programming


Exercise 6.6:

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.


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

    }
}
Exercisey 6.6






Privacy Policy:



Google uses associated advertising companies to serve ads when it visits our website. These companies may use the information they obtain from your visits to this and other websites (not including your name, address, email address, or phone number) to provide you with announcements about products and services that interest you. If you would like to learn more about this practice and know your options to prevent these companies from using this information. Click in... Privacy and Terms of Google.

Cookies

This site uses Google cookies to provide its services, to personalize advertisements and to analyze traffic. Google receives information about your use of this website. More information in... Privacy and Terms of Google.