網頁

2020年6月9日 星期二

新版Visual C# 物件導向 Class算一群人bmi實作

66 則留言:

  1. B10833034 彭仲麟2020年6月10日 上午10:45

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

    namespace test0610
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,可算一群人的BMI。");
    Person[] XX = new Person[3];
    XX[0] = new Person(158,41,"清姬");
    XX[1] = new Person(152,44, "阿比蓋爾·威廉斯");
    XX[2] = new Person(162,51, "葛飾北齋");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("========================");
    }
    Console.Read();
    }

    }
    }

    回覆刪除
  2. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace T0610
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
    Person [] XX = new Person[3];
    XX[0] = new Person();
    XX[1] = new Person("喬瑟夫·喬斯達", 'm', 195, 97);
    XX[2] = new Person("Emiya archer", 'm', 187, 78);
    foreach(Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name = "阿爾托莉亞·潘德拉剛";
    char sex = 'f';
    double h = 154;
    double w = 42;
    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h:" + h);
    Console.WriteLine("w:" + w);
    Console.WriteLine("bmi:" + bmi());
    Console.WriteLine("=====================");
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public Person() { }
    public Person(string _name, char _sex, double _h, double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  3. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("....");
    Person[] XX = new Person[3];
    XX[0] = new Person(170, 55, "A momomomomo~");
    XX[1] = new Person(180, 65, "zzzzzz");
    XX[2] = new Person(173, 87, "aaaaaa");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  4. B10833029 余柏翰2020年6月10日 上午11:02

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

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  5. b10833024 王翔緯2020年6月10日 上午11:02

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

    namespace bmi
    {
    class Program
    {
    class Person
    {
    double h,w;
    string name;
    public double bmi()
    {
    return 10000.0 * w/(h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person (double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    name = _name;

    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadLine();

    }
    }
    }

    回覆刪除
  6. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace Bmi_oop
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("AI幫你算一群人的BMI!");
    Person [] XX = new Person[4];
    XX[0] = new Person();
    XX[1] = new Person("阿金", 'm', 174, 60);
    XX[2] = new Person("阿銀", 'm', 178, 65);
    XX[3] = new Person("阿星", 'm', 180, 75);
    foreach (Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name = "張阿明";
    char sex = 'f';
    double h = 160;
    double w = 50;
    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h:" + h);
    Console.WriteLine("w:" + w);
    Console.WriteLine("bmi:" + bmi());
    Console.WriteLine("================");
    }
    public void looseweight(double ww)
    {
    w -= ww;
    }
    double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public Person() { }
    public Person(string _name,char _sex,double _h,double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  7. b10833042 謝孟修2020年6月10日 上午11:03

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

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  8. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace BMI_oop
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習POP");
    Person[] XX = new Person[3];
    XX[0] = new Person(180, 70, "Alex");
    XX[1] = new Person(160, 46, "Emma");
    XX[2] = new Person(165, 50, "John");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi="+X.bmi());
    Console.WriteLine("==========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  9. using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習oop");
    person x = new person(165, 55, "Alice");
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.ReadKey();
    }
    }

    }
    }

    回覆刪除
  10. b10833033 蔡孟頻2020年6月10日 上午11:03

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

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person X = new Person(165, 55, "Alice");
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.ReadKey();
    }
    }

    }

    回覆刪除
  11. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp3
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name="+name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習Top");
    Person[] XX = new Person[3];
    XX [0] = new Person(165, 68, "Alice");
    XX [1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  12. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace T0610
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
    Person [] XX = new Person[3];
    XX[0] = new Person();
    XX[1] = new Person("DanDan", 'm', 190, 69);
    XX[2] = new Person("BuBu", 'm', 187, 65);
    foreach(Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name = "shuoyenjyun";
    char sex = 'f';
    double h = 160;
    double w = 50;
    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h:" + h);
    Console.WriteLine("w:" + w);
    Console.WriteLine("bmi:" + bmi());
    Console.WriteLine("====================");
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public Person() { }
    public Person(string _name, char _sex, double _h, double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  13. b10833023 陳姿茹2020年6月10日 上午11:03

    using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    String name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    person[] XX = new person[3];
    XX[0] = new person(150, 45, "Alice");
    XX[1] = new person(178, 90, "John");
    XX[2] = new person(175, 60, "Carl");
    foreach (person X in XX)
    {
    X.print();
    Console.WriteLine("BMI=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();

    }
    }
    }

    回覆刪除
  14. using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);

    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("Hello World!");
    person[] XX = new person[3];
    XX[0] = new person(150, 45, "Alice");
    XX[1] = new person(178, 90, "John");
    XX[2] = new person(175, 60, "Carl");
    foreach(person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  15. B10833069 鍾秉哲2020年6月10日 上午11:03

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

    namespace T0610
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi。");
    Person [] XX = new Person[3];
    XX[0] = new Person();
    XX[1] = new Person("DanDan", 'm', 190, 69);
    XX[2] = new Person("BuBu", 'm', 187, 65);
    foreach(Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name = "saber";
    char sex = 'f';
    double h = 160;
    double w = 50;
    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h:" + h);
    Console.WriteLine("w:" + w);
    Console.WriteLine("bmi:" + bmi());
    Console.WriteLine("====================");
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public Person() { }
    public Person(string _name, char _sex, double _h, double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  16. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  17. b10833046 王子榮2020年6月10日 上午11:04

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

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  18. using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);

    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("Hello World!");
    person[] XX = new person[3];
    XX[0] = new person(150, 45, "Alice");
    XX[1] = new person(178, 90, "John");
    XX[2] = new person(175, 60, "Carl");
    foreach(person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  19. b10833114 鍾杰廷2020年6月10日 上午11:04

    using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    String name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    person[] XX = new person[3];
    XX[0] = new person(150, 45, "Alice");
    XX[1] = new person(178, 90, "John");
    XX[2] = new person(175, 60, "Carl");
    foreach (person X in XX)
    {
    X.print();
    Console.WriteLine("BMI=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();

    }
    }
    }

    回覆刪除
  20. b10833072 吳仲倫2020年6月10日 上午11:04

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

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  21. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace _0610
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列人的bmi");
    Person[] XX = new Person[3];
    XX[0] = new Person();
    XX[1]= new Person("小小", 'm', 170, 69);
    XX[2] = new Person("小黑", 'm', 189, 69);
    foreach (Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name = "王小美";
    char sex = 'f';
    double h = 160;
    double w = 50;
    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h:" + h);
    Console.WriteLine("w:" + w);
    Console.WriteLine("bmi:" + bmi());
    Console.WriteLine("=============");
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }

    double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public Person() { }
    public Person(string _name, char _sex, double _h, double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  22. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習oop");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  23. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  24. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  25. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習oop");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  26. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("BMI");
    Person[] XX = new Person[3];
    XX[0] = new Person();
    XX[1] = new Person("BB", 'm', 173, 65);
    XX[2] = new Person("COCO", 'f', 170, 61);
    foreach (Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name="CNN";
    char sex = 'f';
    double h = 160;
    double w = 50;

    public void print()
    {
    Console.WriteLine("name:" + name);
    Console.WriteLine("sex:" + sex);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("bmi=" + bmi());
    Console.WriteLine("===============");
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public Person() { }
    public Person(string _name, char _sex, double _h, double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  27. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  28. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  29. b10833004 黃薰田2020年6月10日 上午11:07

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

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  30. D10811007 蘇鈺貽2020年6月10日 上午11:07

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  31. b10833037 沈泉澔2020年6月10日 上午11:07

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

    namespace bmi
    {
    class Program
    {
    class Person
    {
    double h,w;
    string name;
    public double bmi()
    {
    return 10000.0 * w/(h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person (double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    name = _name;

    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadLine();

    }
    }
    }

    回覆刪除
  32. B10833012 何郁麒2020年6月10日 上午11:07

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  33. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習oop");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  34. B10833044 范光祐2020年6月10日 上午11:08

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  35. B10833038 陳冠傑2020年6月10日 上午11:08

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  36. B10815036 李宥陞2020年6月10日 上午11:09

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  37. B10833082 黃鈺淇2020年6月10日 上午11:09

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

    namespace bmi_oop
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;

    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("BMI");
    Person[] XX = new Person[3];
    XX[0] = new Person(163, 55, "Selina");
    XX[1] = new Person(160, 50, "Hebe");
    XX[2] = new Person(165, 55, "Ella");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("____________________________");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  38. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  39. B10833016 余竺瑾2020年6月10日 上午11:10

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  40. B10833019 葉劉辰2020年6月10日 上午11:10

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("寫一個物件導向的程式,要幹嘛?算一陣列入人的bmi。");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Mary");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 78, "Vick");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }
    }

    回覆刪除
  41. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  42. B10833041 黃柏凱2020年6月10日 上午11:16

    using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  43. b10833022 許家銘2020年6月10日 上午11:16

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

    namespace bmi_oop
    {
    class Program
    {
    static void Main(string[] args)//控制
    {
    Console.WriteLine("寫一個物件導向程式,要做什麼?算一陣列的BMI。");

    Person [] XX = new Person [3];
    XX[0] = new Person();
    XX[1] = new Person("小小", 'm', 170, 69);
    XX[2] = new Person("小王", 'm', 179, 79);
    foreach (Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name="王小美";
    char sex='f';
    double h = 160;
    double w = 50;

    public double bmi()//算bmi
    {
    return 10000.0 * w / (h * h);
    }
    public void print()//格式
    {
    Console.WriteLine("name=" + name);
    Console.WriteLine("sex=" + sex);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("bmi" + bmi());
    Console.WriteLine("====================");

    }
    public Person() { }//列印
    public Person(string _name, char _sex,double _h,double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  44. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  45. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  46. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  47. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace bmi02
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("BMI練習");
    Person[] XX= new Person[3];
    XX[0] = new Person(173, 87, "Big Pack01");
    XX[1] = new Person(173, 90, "Big Pack02");
    XX[2] = new Person(173, 93, "Big Pack03");

    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("sex:" + 'm');
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("=================");
    }
    Console.ReadKey();
    }
    }
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("name=" + name);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    }

    回覆刪除
  48. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  49. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  50. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace bmi02
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("BMI練習");
    Person[] XX= new Person[3];
    XX[0] = new Person(173, 87, "Big Pack01");
    XX[1] = new Person(173, 90, "Big Pack02");
    XX[2] = new Person(173, 93, "Big Pack03");

    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("sex:" + 'm');
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("=================");
    }
    Console.ReadKey();
    }
    }
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("name=" + name);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    }

    回覆刪除
  51. b10833022 許家銘2020年6月10日 上午11:24

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

    namespace bmi_oop
    {
    class Program
    {
    static void Main(string[] args)//控制
    {
    Console.WriteLine("寫一個物件導向程式,要做什麼?算一陣列的BMI。");

    Person [] XX = new Person [3];
    XX[0] = new Person();
    XX[1] = new Person("小小", 'm', 170, 69);
    XX[2] = new Person("小王", 'm', 179, 79);
    foreach (Person X in XX)
    {
    X.print();
    }
    Console.Read();
    }
    }
    class Person
    {
    string name="王小美";
    char sex='f';
    double h = 160;
    double w = 50;

    public double bmi()//算bmi
    {
    return 10000.0 * w / (h * h);
    }
    public void print()//格式化
    {
    Console.WriteLine("name=" + name);
    Console.WriteLine("sex=" + sex);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("bmi" + bmi());
    Console.WriteLine("====================");

    }
    public Person() { }//列印
    public Person(string _name, char _sex,double _h,double _w)
    {
    name = _name;
    sex = _sex;
    h = _h;
    w = _w;
    }
    }
    }

    回覆刪除
  52. 使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    名稱空間bmi02
    {
    類程序
    {
    靜態void Main(string [] args)
    {
    Console.WriteLine(“ BMI練習”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(173,87,“ Big Pack01”);
    XX [1] =新人物(173,90,“ Big Pack02”);
    XX [2] =新人(173、93,“ Big Pack03”);

    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“ sex:” +'m');
    Console.WriteLine(“ bmi =” + X.bmi());
    Console.WriteLine(“ =================);
    }
    Console.ReadKey();
    }
    }
    類Person
    {
    double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }

    public void print()
    {
    Console.WriteLine(“ name =” + name);
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    }
    public voidlackWeight(double ww)
    {
    w-= ww;
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;
    }
    }
    }

    回覆刪除
  53. 使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    命名空間ConsoleApp1
    {
    類Program
    {
    類Person
    {
    Double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;


    }
    }
    static void Main(string [] args)
    {
    Console.WriteLine(“習題庫”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(170,60,“ MapleRD”);
    XX [1] =新人(178、90,“火妹”);
    XX [2] =新人物(165、70,“胖子”);
    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“
    Console.WriteLine(“ ============”);
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  54. 使用系統;

    命名空間ConsoleApp2
    {
    類Person
    {
    double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;
    }

    static void Main(string [] args)
    {
    Console.WriteLine(“練習用OOP”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(165,68,“
    XX [1] =新人(190、80,“ zoe”);
    XX [2] = new Person(180,60,“ john”);
    foreach(XX中的人員x)
    {
    x.print();
    Console.WriteLine(“ bmi =” + x.bmi());
    Console.WriteLine(“ ===========”);
    }
    Console.ReadKey();
    }

    回覆刪除
  55. b10815038 溫政祥2020年6月10日 上午11:46

    using System;

    namespace ConsoleApp1
    {
    class Program
    {
    class person
    {
    double h, w;
    String name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public person() { }
    public person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    person[] XX = new person[3];
    XX[0] = new person(150, 45, "Alice");
    XX[1] = new person(178, 90, "John");
    XX[2] = new person(175, 60, "Carl");
    foreach (person X in XX)
    {
    X.print();
    Console.WriteLine("BMI=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();

    }
    }
    }

    回覆刪除
  56. B10815088徐仁祥2020年6月10日 下午1:26

    使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    命名空間ConsoleApp1
    {
    類Program
    {
    類Person
    {
    Double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;


    }
    }
    static void Main(string [] args)
    {
    Console.WriteLine(“習題庫”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(170,60,“ MapleRD”);
    XX [1] =新人(178、90,“火妹”);
    XX [2] =新人物(165、70,“胖子”);
    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“
    Console.WriteLine(“ ============”);
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  57. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  58. using System;

    namespace ConsoleApp2
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() {}
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }

    static void Main(string[] args)
    {
    Console.WriteLine("練習用OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165,68,"alice");
    XX[1]= new Person(190, 80, "zoe");
    XX[2]= new Person(180, 60, "john");
    foreach (Person x in XX)
    {
    x.print();
    Console.WriteLine("bmi=" + x.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }

    回覆刪除
  59. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  60. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace bmi02
    {
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("BMI練習");
    Person[] XX= new Person[3];
    XX[0] = new Person(173, 87, "Big Pack01");
    XX[1] = new Person(173, 90, "Big Pack02");
    XX[2] = new Person(173, 93, "Big Pack03");

    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("sex:" + 'm');
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("=================");
    }
    Console.ReadKey();
    }
    }
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }

    public void print()
    {
    Console.WriteLine("name=" + name);
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    }
    public void looseWeight(double ww)
    {
    w -= ww;
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    }

    回覆刪除
  61. using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApp1
    {
    class Program
    {
    class Person
    {
    Double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;


    }
    }
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(170,60,"MapleRD");
    XX[1] = new Person(178, 90, "fire sister");
    XX[2] = new Person(165, 70, "fatfat");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  62. B10833018 杜立笙2020年6月16日 晚上9:40

    使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    命名空間ConsoleApp1
    {
    類Program
    {
    類Person
    {
    Double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;


    }
    }
    static void Main(string [] args)
    {
    Console.WriteLine(“習題庫”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(170,60,“ MapleRD”);
    XX [1] =新人(178、90,“火妹”);
    XX [2] =新人物(165、70,“胖子”);
    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“
    Console.WriteLine(“ ============”);
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  63. 使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    命名空間ConsoleApp1
    {
    類Program
    {
    類Person
    {
    Double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;


    }
    }
    static void Main(string [] args)
    {
    Console.WriteLine(“習題庫”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(170,60,“ MapleRD”);
    XX [1] =新人(178、90,“火妹”);
    XX [2] =新人物(165、70,“胖子”);
    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“
    Console.WriteLine(“ ============”);
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  64. b10833070葉奕志2020年6月17日 上午9:21

    使用系統;
    使用System.Collections.Generic;
    使用System.Linq;
    使用System.Text;
    使用System.Threading.Tasks;

    命名空間ConsoleApp1
    {
    類Program
    {
    類Person
    {
    Double h,w;
    字符串名稱;
    public double bmi()
    {
    返回10000.0 * w /(h * h);
    }
    public void print()
    {
    Console.WriteLine(“ h =” + h);
    Console.WriteLine(“ w =” + w);
    Console.WriteLine(“ name =” + name);
    }
    public Person(){}
    public Person(double _h,double _w,string _name)
    {
    h = _h;
    w = _w;
    名稱= _名稱;


    }
    }
    static void Main(string [] args)
    {
    Console.WriteLine(“習題庫”);
    Person [] XX =新的Person [3];
    XX [0] =新人物(170,60,“ MapleRD”);
    XX [1] =新人(178、90,“火妹”);
    XX [2] =新人物(165、70,“胖子”);
    foreach(XX中的人X)
    {
    X.print();
    Console.WriteLine(“
    Console.WriteLine(“ ============”);
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  65. b10833020 黃俊浩2020年6月17日 上午9:51

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

    namespace ConsoleApp1
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("練習OOP");
    Person[] XX = new Person[3];
    XX[0] = new Person(165, 68, "Alice");
    XX[1] = new Person(178, 90, "John");
    XX[2] = new Person(175, 70, "Carl");
    foreach(Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("==============");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除
  66. b10833020 黃俊浩2020年6月17日 上午9:53

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

    namespace bmi
    {
    class Person
    {
    double h, w;
    string name;
    public double bmi()
    {
    return 10000.0 * w / (h * h);
    }
    public void print()
    {
    Console.WriteLine("h=" + h);
    Console.WriteLine("w=" + w);
    Console.WriteLine("name=" + name);
    }
    public Person() { }
    public Person(double _h, double _w, string _name)
    {
    h = _h;
    w = _w;
    name = _name;
    }
    }
    class Program
    {
    static void Main(string[] args)
    {
    Console.WriteLine("....");
    Person[] XX = new Person[3];
    XX[0] = new Person(170, 55, "A momomomomo~");
    XX[1] = new Person(180, 65, "zzzzzz");
    XX[2] = new Person(173, 87, "aaaaaa");
    foreach (Person X in XX)
    {
    X.print();
    Console.WriteLine("bmi=" + X.bmi());
    Console.WriteLine("===========");
    }
    Console.ReadKey();
    }
    }
    }

    回覆刪除

HTML 編輯器