Site blog

by 97213529 郭益銘 - Sunday, January 11, 2009, 8:40 PM
Anyone in the world
data:
Employee 阿狗 15.5
Manager 阿貓 40
code:

using System;
using System.IO;
class Employee
{

private string name;
protected float billingRate;
protected float salary;

public Employee(string name, float billingRate)
{
this.name = name;
this.billingRate = billingRate;
}

public float CalculateCharge(float hours)
{
return (salary = hours * billingRate);
}
public float GetSalary()
{
return salary;
}
public string TypeName()
{
return ("Employee");
}
}

class Manager : Employee
{
private float allowance;

public Manager(string name, float billingRate): base(name, billingRate)
{
allowance = 1000;
}
public new float CalculateCharge(float hours)
{
if (hours < 1.0F)
hours = 1.0F;
return (salary = hours * billingRate+allowance);
}

public new string TypeName()
{
return ("Civil Employee");
}
}
class Test
{
public static void Main()
{
Console.Write("請輸入檔案位置:");
string path2 = Console.ReadLine();
StreamReader sr = new StreamReader(@path2,System.Text.Encoding.Default);
string str = sr.ReadToEnd();
string[] s = str.Split('\n');
Employee[] e = new Employee[s.Length];
for (int i = 0; i < s.Length; i++)
{
string[] tmp = s[i].Split(' ');
if (tmp[0] == "Manager")
e[i] = new Manager(tmp[1], float.Parse(tmp[2]));
else if (tmp[0] == "Employee")
e[i] = new Employee(tmp[1], float.Parse(tmp[2]));
}
for (int i = 0; i < e.Length; i++)
{
e[i].CalculateCharge(i * 1.0F + 20.0F);
Console.WriteLine("{0} charge = {1}", e[i].TypeName(), e[i].GetSalary());
}

}
}

Comments

     
    by 97213529 郭益銘 - Monday, December 22, 2008, 2:39 AM
    Anyone in the world

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections;

    namespace ConvertTest
    {
        class zzz
        {
            public double to10(string value, int based)
            {
                double sum = 0.0;
                int count = 0;
                if (value.Contains("."))
                    count = value.IndexOf('.') - 1;
                else
                    count = value.Length - 1;
                for (int i = 0; i < value.Length; i++) //n=>10
                    if (value[i] != '.')
                    {
                        if (char.Parse(value[i].ToString().ToUpper()) >='A')
                            sum += (char.Parse(value[i].ToString().ToUpper())-'A'+10) * Math.Pow(based, count--);
                        else
                        sum += Int32.Parse(value[i].ToString()) * Math.Pow(based, count--);
                    }
                return sum;
            }
            public void TentoN(double sum,int gg)
            {
                string[] arr = sum.ToString().Split('.');
                ArrayList dog1 = new ArrayList();
                int left = Int32.Parse(arr[0]);
                while (left != 0)
                {
                    dog1.Add(left % gg);
                    left /= gg;
                }
                dog1.Reverse();
                if (sum.ToString().Contains("."))
                {
                    dog1.Add(".");
                    double right = double.Parse("0." + arr[1].ToString());
                    for (int i = 0; i < 10; i++)
                    {
                        if (Math.Floor(right) == Math.Ceiling(right))
                            break;
                        right = right * gg;
                        dog1.Add(Math.Floor(right));
                        right = right - Math.Floor(right);
                    }
                }
                for (int i = 0; i < dog1.Count; i++)
                {
                    if (Int32.Parse(dog1[i].ToString())>9)
                        Console.Write((char)('A' + 10 - Int32.Parse(dog1[i].ToString())));
                    else
                        Console.Write(dog1[i]);
                }
            }
        }
        class Program
        {
            static void Main(string[] args)
            {
                Console.Write("請輸入數值:");
                string value = Console.ReadLine();
                Console.Write("請輸入基底:");
                int based = Int32.Parse(Console.ReadLine());
                zzz dog = new zzz();
                double sum = dog.to10(value,based);
                Console.WriteLine("10進位是 " + sum);//10
                //=========================TO 10==================
                Console.Write("請輸入基底:");
                int gg = Int32.Parse(Console.ReadLine());
                //int a=Convert.ToInt32(arr[0]);
                dog.TentoN(sum, gg);
                Console.ReadKey();
            }
        }
    }

    Tags:

    Comments

       
      by 97213529 郭益銘 - Monday, December 22, 2008, 1:50 AM
      Anyone in the world

      using System;
      using System.Collections.Generic;
      using System.Text;

      namespace ConsoleApplication7
      {
          class matrix
          {
              public int[,] a;
              public matrix(int dog1,int dog2)//見夠子
              {
                  a = new int[dog1, dog2];
              }
              public void insert()//書入資廖
              {
                  Console.WriteLine("開始輸入矩陣的資料");
                  for (int i = 0; i < a.GetLength(0); i++)
                  {
                      for (int j = 0; j < a.GetLength(1); j++)
                      {
                          Console.Write("輸入第[{0},{1}] 的資料: ", i, j);
                          a[i, j] = Int32.Parse(Console.ReadLine());
                      }
                  }
              }
              public static matrix operator *(matrix dog1, matrix dog2) //****
              {
                  matrix c = new matrix(dog1.a.GetLength(0),dog2.a.GetLength(1));
               
                  for (int i = 0; i < c.a.GetLength(0); i++)
                  {
                      for (int j = 0; j < c.a.GetLength(1); j++)
                      {
                          for (int k = 0; k < dog1.a.GetLength(1); k++)
                          {
                              c.a[i, j] += dog1.a[i, k] * dog2.a[k, j];
                          }
                      }
                  }
                  return c;
              }
       
              public void Print(matrix dog)
              {
                  Console.WriteLine("a 陣列是 ");
                  for (int i = 0; i < dog.a.GetLength(0); i++)
                  {
                      for (int j = 0; j < dog.a.GetLength(1); j++)
                      {
                          Console.Write("{0} ", dog.a[i, j]);
                      }
                      Console.WriteLine();
                  }
              }
            

          }

          class Program
          {
             
              static void Main(string[] args)
              {
                  int v, x, y, z;
                  Console.WriteLine("請輸入第一個矩陣第一維度的大小");
                  v = Int32.Parse(Console.ReadLine());
                  Console.WriteLine("請輸入第一個矩陣第二維度的大小");
                  x = Int32.Parse(Console.ReadLine());

                  matrix m1 = new matrix(v, x);
                  m1.insert();

                  Console.WriteLine("請輸入第二個矩陣第一維度的大小");
                  y = Int32.Parse(Console.ReadLine());
                  Console.WriteLine("請輸入第二個矩陣第二維度的大小");
                  z = Int32.Parse(Console.ReadLine());

                  matrix m2 = new matrix(y, z);
                  m2.insert();

                  if (x == y)
                  {
                      m1.Print(m1 * m2);
                  }
                  else
                  {
                      Console.WriteLine("第一矩陣的第二維度不等於第二矩陣的第一維度,故不能相乘");
                  }

       

              }
          }
      }

       

      Comments

         
        by 97213529 郭益銘 - Tuesday, December 9, 2008, 10:22 AM
        Anyone in the world

        select dog.Provider_no from provider dog
        where dog.Provider_no not in



        (select distinct Provider.Provider_no from



        (
        SELECT Provider.Provider_no,p1.Item_No
        FROM Provide p1,Provider
        where p1.Provider_no='001' and Provider.Provider_no not in
        (SELECT provide.Provider_no FROM Provider INNER JOIN provide ON Provider.Provider_no = provide.Provider_no where p1.Item_no = provide.Item_no)
        )



        )
        Tags:

        Comments

           
          by 97213529 郭益銘 - Thursday, December 4, 2008, 5:32 PM
          by 97213529 郭益銘 - Tuesday, December 2, 2008, 4:36 PM
          Anyone in the world

          Select Store.Sales_Region, dog from

          (Select Store.Sales_Region, SUM(Total) as dog from

          (SELECT  Sale.Store_No, SUM(Sale.Units_Sold* Item.Unit_Price) as Total

          from Sale, Item

          where Sale.Item_No = Item.Item_No group by Sale.Store_No) , Store

          where Sale.Store_No = Store.Store_No

          group by Store.Sales_Region)

          where dog =

          (Select Max(dog) from
          (Select Store.Sales_Region, SUM(Total) as dog from
          (SELECT  Sale.Store_No, SUM(Sale.Units_Sold* Item.Unit_Price) as Total

          from Sale, Item

          where Sale.Item_No = Item.Item_No group by Sale.Store_No) , Store

          where Sale.Store_No = Store.Store_No

          group by Store.Sales_Region))
          Tags:

          Comments

             
            by 97213529 郭益銘 - Tuesday, December 2, 2008, 3:31 PM
            Anyone in the world
            Select Store_No,Total from  (SELECT Sale.Store_No, SUM(Sale.Units_Sold* Item.Unit_Price) as Total from Sale, Item where Sale.Item_No = Item.Item_No group by Sale.Store_No)
            where Total  IN (Select Max(Total) from (SELECT Sale.Store_No, SUM(Sale.Units_Sold* Item.Unit_Price) as Total from Sale, Item where Sale.Item_No = Item.Item_No group by Sale.Store_No))

            Comments

               
              by 96214503 吳孟學 - Wednesday, November 26, 2008, 11:31 AM
              Anyone in the world

              TA工作日誌<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

              日期: 97  11 

              授課老師姓名:張清和 老師

              課程名稱:初級會計學與實習

              課程助理姓名:吳孟學、劉惠文

              協助教學時間:週四19:0021:00

              報告內容

              學生出席態度:   9  1-10(不良-良好)    學生上課態度:   7    1-10

              學生對課程內容理解情形:   7  1-10分    學生與授課教師互動狀況:   8  1-10

              學生作業完成狀況:   9   1-10

              工作內容

              1.  對教師授課內容先進行討論,然後講解習題,或請同學回答。

              2.  每週office-hour時間為週二、週三上午900~1200,在財金系研究室協助學生解答課業問題。

              3.  編制實習課程內容的講義、隨堂測驗的題目與解答

              4. 11/511/26安排隨堂測驗補考

              學生學習狀況

              1.  上課內容和老師上課進度不同,但經講解後,同學們對於內容,大致都能瞭解。

              2.   會計題目較多也較複雜,我花較多的時間來解說,學生學習情形還不錯,大致都能跟上進度。

              3.   選取課本的習題讓同學當練習。

              課後輔導狀況

              1.  11/611/23office-hour時間有同學來問問題。

              2.  11/13同學們對於課程不甚瞭解的地方會在課後主動發問。

              目前整體成效

              同學們對老師上課內容不懂的地方會主動詢問,且經解釋後,都能理解,因此整體上都能跟上進度。

              遭遇困境

              1.  上課時間較晚,同學的專注力較差。

              2.  討論題目較多,無法納入所有會計概念於實習課中。

              3.  學生閱讀英文習題,感到吃力。

              建議事項

              其他

              Comments

                 
                by 96214503 吳孟學 - Wednesday, November 26, 2008, 11:22 AM
                Anyone in the world

                TA工作日誌<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

                日期: 97  10 

                授課老師姓名:張清和 老師

                課程名稱:初級會計學與實習

                課程助理姓名:吳孟學、劉惠文

                協助教學時間:週四19:0021:00

                報告內容

                學生出席態度:   8  1-10(不良-良好)    學生上課態度:   7    1-10

                學生對課程內容理解情形:   9   1-10分    學生與授課教師互動狀況:   6    1-10

                學生作業完成狀況:   9   1-10

                工作內容

                1.  對教師授課內容先進行討論,然後講解習題,或請同學回答。

                2.  每週office-hour時間為週二、週三上午900~1200,在財金系研究室協助學生解答課業問題。

                3.  編制實習課程內容的講義、隨堂測驗的題目與解答

                4. 課本外的額外習題放至課程資訊網(moodle)

                學生學習狀況

                1.  上課內容和老師上課進度不同,但經講解後,同學們對於內容,大致都能瞭解。

                2.   會計題目較多也較複雜,我花較多的時間來解說,學生學習情形還不錯,大致都能跟上進度。

                3.   選取課本的習題讓同學當練習。

                課後輔導狀況

                1.  10/810/15office-hour時間一位同學來問問題。

                2.  同學們對於課程不甚瞭解的地方會在課後主動發問。

                目前整體成效

                同學們對老師上課內容不懂的地方會主動詢問,且經解釋後,都能理解,因此整體上都能跟上進度。

                遭遇困境

                1.  上課時間較晚,同學的專注力較差。

                2.  討論題目較多,無法納入所有會計概念於實習課中。

                3.  學生閱讀英文習題,感到吃力。

                建議事項

                其他

                 

                Comments

                   
                  by 97213529 郭益銘 - Monday, November 17, 2008, 12:49 AM
                  Anyone in the world
                  下載點1:http://moodle.ncnu.edu.tw/file.php/7345/dogC_.zip

                  下載點2:http://0rz.tw/e9516

                  //=====================鋪克牌=========================
                  ArrayList dog = new ArrayList();
                  int Rand;
                  Random rnd = new Random();
                  for (int i = 1; i <= 52; i++) //設定牌的數字
                  dog.Add(i);
                  for (int i = 0; i < 52; i++) //發5張牌
                  {
                  Rand = rnd.Next(0,dog.Count);
                  if(Convert.ToInt32(dog[Rand])%4==0)
                  Console.WriteLine("梅花{0}", Convert.ToInt32(dog[Rand]) % 13+1);
                  else if (Convert.ToInt32(dog[Rand]) % 4 == 1)
                  Console.WriteLine("方塊{0}", Convert.ToInt32(dog[Rand]) % 13+1);
                  else if (Convert.ToInt32(dog[Rand]) % 4 == 2)
                  Console.WriteLine("紅心{0}", Convert.ToInt32(dog[Rand]) % 13+1);
                  else if (Convert.ToInt32(dog[Rand]) % 4 == 3)
                  Console.WriteLine("黑桃{0}", Convert.ToInt32(dog[Rand]) % 13+1);
                  dog.RemoveAt(Rand);
                  }
                  //=====================Random===================
                  //Random dog = new Random(); //don't in for or while loop
                  //Console.WriteLine(dog.Next(2)); //0~1
                  //Console.WriteLine(dog.Next(2,4)); //2~3
                  //Console.WriteLine(dog.NextDouble()); //0.87..~1 double
                  //double dog1 = (10 - 2) * dog.NextDouble() + 2;
                  //Console.WriteLine(dog1.ToString("##.##")); //2~10 double .2
                  //======================8 to 10 進位=====================
                  //Console.Write("請輸入數值:");
                  //string value = Console.ReadLine();
                  //double sum = 0.0;
                  //int count = 0;
                  //if (value.Contains("."))
                  // count = value.IndexOf('.') - 1;//IndexOf('.')表示陣列第.個
                  //else
                  // count = value.Length - 1;
                  //for (int i = 0; i < value.Length; i++) //n=>10
                  // if (value[i] != '.')
                  // sum += Int32.Parse(value[i].ToString()) * Math.Pow(8, count--);
                  //Console.WriteLine("10進位是 " + sum);//10
                  ////=========================10 TO 8==================
                  //string[] arr = sum.ToString().Split('.');
                  //int gg = 8;
                  //ArrayList dog1 = new ArrayList();
                  //int left = Int32.Parse(arr[0]);
                  //while (left != 0)
                  //{
                  // dog1.Add(left % gg);
                  // left /= gg;
                  //}
                  //dog1.Reverse();
                  //if (sum.ToString().Contains("."))
                  //{
                  // dog1.Add(".");
                  // double right = double.Parse("0." + arr[1].ToString());
                  // for (int i = 0; i < 10; i++)
                  // {
                  // if (Math.Floor(right) == Math.Ceiling(right))
                  // break;
                  // right = right * gg;
                  // dog1.Add(Math.Floor(right));
                  // right = right - Math.Floor(right);
                  // }
                  //}
                  //for (int i = 0; i < dog1.Count; i++)
                  // Console.Write(dog1[i]);
                  //=====================尾巴compare======================
                  //Console.Write("請輸入一個字串: "); //尾巴
                  //string input = Console.ReadLine();
                  //Console.Write("請輸入一個字串: ");
                  //string input2 = Console.ReadLine();

                  //Console.Write("最大相似尾巴為: ");
                  //ArrayList dog = new ArrayList();
                  //for (int i = 1; i < Math.Min(input.Length, input2.Length); i++)
                  // if (input[input.Length - i] == input2[input2.Length - i])
                  // dog.Add(input[input.Length - i]);
                  // else
                  // break;
                  //dog.Reverse();
                  //for (int i = 0; i < dog.Count; i++)
                  // Console.Write(dog[i]);
                  //=====================middle===============
                  //int dog1; //middle
                  //string[] input = Console.ReadLine().Split(' ');
                  //dog1 = input.Length / 2;
                  //if (input.Length % 2 != 0)
                  // Console.WriteLine(input[dog1]);
                  //else
                  // Console.WriteLine((Convert.ToDouble(input[dog1]) + Convert.ToDouble(input[dog1-1])) / 2.0);
                  //=====================11010 2=>10==============
                  //char[] input = Console.ReadLine().ToCharArray(); //11010 2=>10
                  //double sum = 0;
                  //for (int i = 0; i < input.Length; i++)
                  //{
                  // sum += Convert.ToInt32(input[i].ToString()) * Math.Pow(2, input.Length - 1 - i);
                  //}
                  //Console.WriteLine(sum);
                  //=====================char+2 & char-2=============
                  //char[] input = Console.ReadLine().ToUpper().ToCharArray(); //char+2 & char-2
                  //int dog = 0;
                  //if (input[0] == '+')
                  //{
                  // for (int i = 1; i < input.Length; i++)
                  // {
                  // dog = Convert.ToInt32(input[i]) + 2;
                  // if (dog > Convert.ToInt32('Z'))
                  // Console.Write("{0}", Convert.ToChar(Convert.ToInt32('A') + dog - Convert.ToInt32('Z') - 1));
                  // else
                  // Console.Write("{0}", Convert.ToChar(dog));
                  // }
                  //}
                  //else if (input[0] == '-')
                  //{
                  // for (int i = 1; i < input.Length; i++)
                  // {
                  // dog = Convert.ToInt32(input[i]) - 2;
                  // if (dog < Convert.ToInt32('A'))
                  // Console.Write("{0}", Convert.ToChar(Convert.ToInt32('Z')-(Convert.ToInt32('A')-dog)+1));
                  // else
                  // Console.Write("{0}", Convert.ToChar(dog));
                  // }
                  //}

                  //======================//look look = ok=================
                  //Console.Write("請輸入你的資料檔 .txt 的位置 ");
                  //string path = Console.ReadLine();
                  //StreamReader sr = new StreamReader(@path);

                  //string all_line = "";
                  //while (!sr.EndOfStream)
                  //{
                  // all_line = sr.ReadLine();
                  // Console.WriteLine(all_line);
                  //}
                  ////=============================ReadToEnd=========================
                  //Console.Write("請輸入你的資料檔 .txt 的位置 ");
                  //string path = Console.ReadLine();
                  //StreamReader sr = new StreamReader(@path);
                  //string all_line = sr.ReadToEnd();
                  //string[] d = all_line.Split(' ', '\n');
                  ////===========================struct===========================
                  //struct studentinfo
                  //{
                  // public string name;
                  // public double chi_grad;
                  // public double eng_grad;
                  //};
                  //static void Main(string[] args) //<<<< //{
                  // studentinfo[] dog = new studentinfo[100];
                  // double highest = 0, lowest = 201;
                  // int highsite = 0, lowsite = 0;
                  // double chinese = 0, english = 0;
                  // int i;
                  // for (i=0; true; i++)
                  // {
                  // string[] tmp = Console.ReadLine().Split(' ');
                  // dog[i].name = tmp[0];
                  // dog[i].chi_grad = Convert.ToDouble(tmp[1]);
                  // dog[i].eng_grad = Convert.ToDouble(tmp[2]);
                  // if (dog[i].chi_grad == 0 && dog[i].eng_grad==0)
                  // break;

                  // if (dog[i].eng_grad + dog[i].chi_grad > highest)
                  // {
                  // highest = dog[i].eng_grad + dog[i].chi_grad;
                  // highsite = i;
                  // }
                  // if (dog[i].eng_grad + dog[i].chi_grad < lowest)
                  // {
                  // lowest = dog[i].eng_grad + dog[i].chi_grad;
                  // lowsite = i;
                  // Console.WriteLine(lowest);
                  // }
                  // chinese += dog[i].chi_grad;
                  // english += dog[i].eng_grad;
                  // }
                  // Console.WriteLine("最高總分的姓名與總成績 : ");
                  // Console.WriteLine("{0} {1} {2} {3} ", dog[highsite].name, dog[highsite].chi_grad + dog[highsite].eng_grad, dog[highsite].chi_grad, dog[highsite].eng_grad);

                  // Console.WriteLine("最低總分的姓名與總成績 : ");
                  // Console.WriteLine("{0} {1} {2} {3} ", dog[lowsite].name, dog[lowsite].chi_grad + dog[lowsite].eng_grad, dog[lowsite].chi_grad, dog[lowsite].eng_grad);

                  // Console.WriteLine("中文的總平均分數 {0} 分 ", chinese / i);
                  // Console.WriteLine("英文的總平均分數 {0} 分 ", english / i);
                  //}
                  Console.ReadKey();

                  Comments

                     

                      
                    RSS