herrDeng網內搜尋

自訂搜尋

Ads

2020年6月9日 星期二

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

66 則留言:

B10833034 彭仲麟 提到...

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

}
}

B10833001宋映嫺 提到...

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

B10833002田昌弘 提到...

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

B10833029 余柏翰 提到...

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

b10833024 王翔緯 提到...

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

}
}
}

A10833002 提到...

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

b10833042 謝孟修 提到...

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

B10833026鄭亞易 提到...

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

b10833027呂沂真 提到...

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

}
}

b10833033 蔡孟頻 提到...

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

}

B10833043彭律惠 提到...

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

B10833096林建鈞 提到...

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

b10833023 陳姿茹 提到...

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

}
}
}

B10833011彭丙玉 提到...

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

B10833069 鍾秉哲 提到...

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

b10833047馮群赫 提到...

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

b10833046 王子榮 提到...

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

B10833010戴俊瑋 提到...

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

b10833114 鍾杰廷 提到...

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

}
}
}

b10833072 吳仲倫 提到...

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

A10833001林承君 提到...

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

B10833028 提到...

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

b10833007林文瑋 提到...

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

b10833010戴俊瑋 提到...

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

B10815089 提到...

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

B10833030吳璟辰 提到...

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

b10833006朱軒廣 提到...

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

B10833031游凱程 提到...

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

b10833004 黃薰田 提到...

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

D10811007 蘇鈺貽 提到...

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

b10833037 沈泉澔 提到...

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

}
}
}

B10833012 何郁麒 提到...

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

B10833014巫明憲 提到...

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

B10833044 范光祐 提到...

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

B10833038 陳冠傑 提到...

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

B10815036 李宥陞 提到...

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

B10833082 黃鈺淇 提到...

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

B10833083夏湘琳 提到...

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

B10833016 余竺瑾 提到...

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

B10833019 葉劉辰 提到...

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

B10833041 提到...

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

B10833041 黃柏凱 提到...

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

b10833022 許家銘 提到...

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

B10833148張詔明 提到...

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

B10833040徐嘉駿 提到...

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

B10833009張恩齊 提到...

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

b10833021楊泓諺 提到...

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

b10833050張少豪 提到...

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

b10833025徐郁堂 提到...

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

B10833021楊泓諺 提到...

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

b10833022 許家銘 提到...

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

B10833018杜立笙 提到...

使用系統;
使用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;
名稱= _名稱;
}
}
}

B10813140邱東建 提到...

使用系統;
使用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();
}
}
}

B10813027唐一渝 提到...

使用系統;

命名空間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();
}

b10815038 溫政祥 提到...

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

}
}
}

B10815088徐仁祥 提到...

使用系統;
使用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();
}
}
}

b10833084詹宗祐 提到...

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

b10833084詹祐宗 提到...

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

b10833070業奕志 提到...

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

B10833073毛聖翔 提到...

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

B10833073毛聖翔 提到...

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

B10833018 杜立笙 提到...

使用系統;
使用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();
}
}
}

B10813027唐一渝 提到...

使用系統;
使用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();
}
}
}

b10833070葉奕志 提到...

使用系統;
使用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();
}
}
}

b10833020 黃俊浩 提到...

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

b10833020 黃俊浩 提到...

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

Related Posts Plugin for WordPress, Blogger...

熱門文章