using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        enum WeekDays
        {
            sat, sun, mon, tue, wed, thu, fri
        }
        const float pi = 3.14F;
        struct Student
        {
            const float e = 2.718F;
            private String _n;
            private float _a;
            //public string n { set { _n = value; } }
            public string getn()
            {
                return _n;
            }
            public string n { get { return _n; } }            
            public float a 
            { 
                get { return _a; }
                set
                {
                    if (value < 0 || value > 20)
                        //MessageBox.Show("Error");
                        throw new Exception("نمره باید بین 0 تا 20 باشد");
                    else
                        _a = value;
                }
            }
            public Student(string x, float y)
            {
                _n = x; _a = y;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //WeekDays w;            
            //double s = 100000;
            //for (w = WeekDays.sat; w <= WeekDays.thu; w++)
            //{
            //    s += 10000;
            //    listBox1.Items.Add(w.ToString());
            //}
            //MessageBox.Show(s.ToString());
            //Student s = new Student("ali",0);
            Student s = new Student();

            //s.n = "ali";
            s.a = 19.5F;
            MessageBox.Show(s.n + "\n" + s.a);
        }
    }
}
