2019年10月30日 星期三

C# 多型 範例

target main
1. 設定 薪水 $70K
2. Bonus $30K
3. 印出 john 經理 Total 薪水

-------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsolePolymorphism1
{
    //定義 Employee 員工當作父類別
    class Employee
    {  // _salary 宣告為保護層級,只讓子類別中使用
       protected int _salary;        //父類別的欄位
          public virtual int Salary  //父類別的屬性
        {
            get {
                return _salary;
            }
            set {
                //薪資< 20000, 以 20000 計算; 薪資 > 40000 以 40000 計算
                if (value < 20000)
                    _salary = 20000;
                else if (value > 40000)
                {
                    _salary = 40000;
                }
                else
                    _salary = value;
            }
        }
    }

    class Manager : Employee
    {
        public int Bonus { get; set; }

        public override int Salary
        {
            get
            {
                return _salary;
            }
            set
            {
                //薪資< 30000, 以 30000 計算; 薪資 > 60000 以 60000 計算
                if (value < 30000)
                    _salary = 30000;
                else if (value > 60000)
                {
                    _salary = 60000;
                }
                else
                    _salary = value;
            }
        }

        public void ShowTotal()
        {
            Console.WriteLine("\n 實領的薪資: {0}元", (Bonus + Salary).ToString("0,0"));
        }

    }
    class Program
    {
        static void Main(string[] args)
        {
       
        Manager john =new Manager();
        john.Salary=70000;
        john.Bounus =30000;
        john.ShowTotal();
        Console.Read();
        }
    }
}

2019年10月29日 星期二

check 迴圈次數

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test1
{
    class Program
    {
        static void Main(string[] arg)
        //以定義一個以上 進入點, modify /main
        // ref : http://justin0002.blogspot.com/2012/12/c.html
        {
            // ref :https://sweetkikibaby.pixnet.net/blog/post/191310453
            int[,] arr1 = new int[3, 2] { {1,2},{ 3,4},{ 5,6} };

            {

                for (int i = 0; i <= arr1.GetLength(0) - 1; i++)
                {
                    for (int j = 0; j <= arr1.GetLength(1) - 1; j++)
                    {
                        Console.WriteLine(arr1[i, j].ToString());
                       
                    }
                    Console.ReadLine();// check 內迴圈次數
                }
                Console.ReadLine();// check 外迴圈次數
            }

        }

    }
}

2019年10月28日 星期一

C#joey1029.txt

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1025_作業繳交
{
    //class Ex1
    //{
    //    static public void ex1()
    //    {
    //        Console.WriteLine("EX1");
    //        Console.Read();
    //    }
    //}
   
    public class Ex1
    {

           using (Ex1 ex1=new Ex1())
           public void ex1(int x,int y)
           //静态方法不能直接使用本类的非静态方法
           {
            //int EX1= Show();
            //   }
            //public int Callbaby()
            //{
            int EX1a = Max(x,y);
            //從 EX1 倒推回去

            //Console.WriteLine(EX1a);

            //Console.Read();
            //int EX1a[] = new int[3];
            //return EX1a;
            //Console.WriteLine(Callbaby.EX1);
            //Object EX1 = new Object();
            //EX1 = EX1a.ToString();
            //Console.WriteLine(EX1);

            Console.WriteLine(EX1a.ToString());
            Console.Read();

        }
        public int Max(int X, int Y)
        {
            return (X > Y) ? X : Y;
        }
    }



    //class Ex1
    //{
    //        static public void ex1()
    //        {
    //        Clac EX1b = new Clac ();
    //        Console.WriteLine(EX1a);
    //            Console.Read();
    //        }
    //}


    //class Class1
    //{
    //    public static void OtherM()
    //    //程式只能有一個 Main 方法。
    //    {
    //        Ex1 Obj = new Ex1();
    //        Obj.Show();
    //    }
    //}

}

2019年10月8日 星期二

ajax - xampp ok - jq-ajax.html

ajax - xampp ok - jq-ajax.html

* test 驗證程式 - 先測 基本功能 是活的



snippet generator

https://snippet-generator.app/

VS Code 中自訂程式碼片段的功能(snippet)
https://pjchender.blogspot.com/2017/04/vs-code-snippet.html


VS2019 安裝
* asp.net
* (node.js)
* net 桌面
* windows 平台

建一個帳戶 joey.wda@hotmail.com
pw : @12


jQuery

$('button') ~1. 找到button~
.click(function()){ ~2. 觸發做什?~
$(this).closet('ul') ~3.本體鄰近的(方法) ul~
.parent().next() ~4. 增加尋找方法 父件的 同層~
.css('color', 'red'); ~給他個 式樣~