網站部落格

頁: () 1 2 3 4 5 6 7 8 9 10 ()
97213529 郭益銘的相片
97213529 郭益銘發表於2009年 01月 11日(週日) 21:10
世界任何人
class Employee
{
private string info; //Private屬性,其他繼承的類別無法改變它的值
public string id, name, sex, position; //其他繼承的類別可以使用這些屬性
public int age, days, salary; //其他繼承的類別可以使用這些屬性

public void ShowPrivateInfo() //透過繼承類別呼叫ShowPrivateInfo()
{
info = "This is a program about class inheritance.";

Console.WriteLine(info);
}

public void ShowBaseInfo() //透過繼承類別呼叫ShowBaseInfo()
{
Console.WriteLine(position + "的基本資訊:") ;
Console.WriteLine("編號:[" + id + "]");
Console.WriteLine("姓名:[" + name + "]");
Console.WriteLine("性別:[" + sex + "]");
Console.WriteLine("年齡:[" + age+ "]");
Console.WriteLine("本月工作天數:[" + days + "]");
}
}

//-----------------------------------------------------------------------------------------

class Manager : Employee //Manager繼承Employee,但薪水算法不同
{
public void CountSalary() //Manager的薪水計算方式:將工作天數帶入薪水計算公式
{
salary = 60000 + days * 1000;

Console.WriteLine(position + "的本月薪水:[" + salary + "]");
}
}

class Normal : Employee //Normal繼承Employee,但薪水算法不同
{
public void CountSalary() //Normal的薪水計算方式:將工作天數帶入薪水計算公式
{
salary = days * 1500;

Console.WriteLine(position + "的本月薪水:[" + salary + "]");
}
}

class HourCount : Employee //HourCount繼承Employee,但薪水算法不同
{
public void CountSalary() //HourCount的薪水計算方式:將工作天數帶入薪水計算公式
{
salary = days * 100 * 8 ;

Console.WriteLine(position + "的本月薪水:[" + salary + "]");
}
}

//-----------------------------------------------------------------------------------------

class Program
{
static void Main(string[] args)
{
string choice;
bool exit = false;

Console.Write("請選擇要輸的的員工資訊:(a)經理 (b)一般員工 (c)時薪人員 (d)離開程式:");
choice = Console.ReadLine();

while (exit == false)
{
if (choice == "a")
{
Manager mm = new Manager(); //宣告一個Manager類別

mm.position = "經理";
mm.ShowPrivateInfo();

//輸入經理的各項資訊
Console.WriteLine("請輸入" + mm.position + "訊息");
Console.Write("編號:");
mm.id = Console.ReadLine();
Console.Write("姓名:");
mm.name = Console.ReadLine();
Console.Write("性別:");
mm.sex = Console.ReadLine();
Console.Write("年齡:");
mm.age = Int32.Parse(Console.ReadLine());
Console.Write("本月工作天數:");
mm.days = Int32.Parse(Console.ReadLine());

Console.WriteLine("-----------------------------------------------------");

//顯示經理的基本訊息與該月薪水
mm.ShowBaseInfo();
mm.CountSalary();
}
else if (choice == "b")
{
Normal nn = new Normal();

nn.position = "一般員工";
nn.ShowPrivateInfo();

//輸入一般員工的各項資訊
Console.WriteLine("請輸入" + nn.position + "訊息");
Console.Write("編號:");
nn.id = Console.ReadLine();
Console.Write("姓名:");
nn.name = Console.ReadLine();
Console.Write("性別:");
nn.sex = Console.ReadLine();
Console.Write("年齡:");
nn.age = Int32.Parse(Console.ReadLine());
Console.Write("本月工作天數:");
nn.days = Int32.Parse(Console.ReadLine());

Console.WriteLine("-----------------------------------------------------");

//顯示一般員工的基本訊息與該月薪水
nn.ShowBaseInfo();
nn.CountSalary();
}
else if (choice == "c")
{
HourCount hh = new HourCount();

hh.position = "時薪人員";
hh.ShowPrivateInfo();

//輸入時薪人員的各項資訊
Console.WriteLine("請輸入" + hh.position + "訊息");
Console.Write("編號:");
hh.id = Console.ReadLine();
Console.Write("姓名:");
hh.name = Console.ReadLine();
Console.Write("性別:");
hh.sex = Console.ReadLine();
Console.Write("年齡:");
hh.age = Int32.Parse(Console.ReadLine());
Console.Write("本月工作天數:");
hh.days = Int32.Parse(Console.ReadLine());

Console.WriteLine("-----------------------------------------------------");

//顯示時薪人員的基本訊息與該月薪水
hh.ShowBaseInfo();
hh.CountSalary();
}
else if (choice == "d") //按 d 離開程式
{
exit = true;
break;
}
else //輸入錯誤時顯示錯誤訊息
{
Console.WriteLine("-----------------------------------------------------");
Console.WriteLine("請輸入正確的選項或是按(d)離開程式!!");
}

Console.WriteLine("-----------------------------------------------------");
Console.Write("請選擇要輸的的員工資訊:(a)經理 (b)一般員工 (c)時薪人員 (d)離開程式:");
choice = Console.ReadLine();
}
}
}

評論

     
    97213529 郭益銘的相片
    97213529 郭益銘發表於2009年 01月 11日(週日) 20:40
    世界任何人
    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());
    }

    }
    }

    評論

       
      97213529 郭益銘的相片
      97213529 郭益銘發表於2008年 12月 22日(週一) 02:39
      世界任何人

      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();
              }
          }
      }

      標籤:

      評論

         
        97213529 郭益銘的相片
        97213529 郭益銘發表於2008年 12月 22日(週一) 01:50
        世界任何人

        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("第一矩陣的第二維度不等於第二矩陣的第一維度,故不能相乘");
                    }

         

                }
            }
        }

         

        評論

           
          97213529 郭益銘的相片
          97213529 郭益銘發表於2008年 12月 9日(週二) 10:22
          世界任何人

          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)
          )



          )
          標籤:

          評論

             
            97213529 郭益銘的相片
            97213529 郭益銘發表於2008年 12月 4日(週四) 17:32
            世界任何人
            http://studentweb.ncnu.edu.tw/97213529/SQL.aspx


            評論

               
              97213529 郭益銘的相片
              97213529 郭益銘發表於2008年 12月 2日(週二) 16:36
              世界任何人

              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))
              標籤:

              評論

                 
                97213529 郭益銘的相片
                97213529 郭益銘發表於2008年 12月 2日(週二) 15:31
                世界任何人
                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))

                評論

                   
                  96214503 吳孟學的相片
                  96214503 吳孟學發表於2008年 11月 26日(週三) 11:31
                  世界任何人

                  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.  學生閱讀英文習題,感到吃力。

                  建議事項

                  其他

                  評論

                     
                    96214503 吳孟學的相片
                    96214503 吳孟學發表於2008年 11月 26日(週三) 11:22
                    世界任何人

                    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.  學生閱讀英文習題,感到吃力。

                    建議事項

                    其他

                     

                    評論

                       
                      頁: () 1 2 3 4 5 6 7 8 9 10 ()

                        
                      RSS