上課沒聽懂


uj5u.com熱心網友回復:
豎著的圖懶得看,不會uj5u.com熱心網友回復:
重新發
uj5u.com熱心網友回復:
我多年的好頸椎被你搞病了
uj5u.com熱心網友回復:
請重新發圖,提問題要學會發圖uj5u.com熱心網友回復:
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
Box box = new Box(3,4,5);
box.Length = 3;
box.Widtbox.Width = 4;
box.Height = 5;
}
}
class Box
{
int length;
int width;
int height;
public int Length
{ get{return length;} set{length=value;} }
public int Width
{ get{return width;} set{width=value;} }
public int Height
{ get{return height;} set{height=value;} }
public Box(int a,int b,int c)
{
length = a;
width = b;
height = c;
}
public int Volume(int a,int b,int c)
{
int V = a * b * c;
return V;
}
public int Area(int a, int b, int c)
{
int S = 2 * (a * b + b * c + c * a);
return S;
}
}
}
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
Foundation foundation = new Foundation();
foundation.AddFund(200);
}
}
class Foundation
{
string name = "name";
static double fundMoney = 1000;
public void AddFund(double a)
{
fundMoney += a;
Console.WriteLine("{0}捐款了{1}元,現在的慈善基金為{2}元", name, a, fundMoney);
}
}
}
第二題第四小問的兩個物件是什么意思沒懂。
namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
Triangle triangle=new Triangle();
Console.WriteLine("線段1:");
int a=int.Parse(Console.ReadLine());
Console.WriteLine("線段2:");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("線段3:");
int c = int.Parse(Console.ReadLine());
if (triangle.IsTriangle(a, b, c))
{
Console.WriteLine("這三條線段可以組成三角形");
double x= triangle.Girth(a, b, c);
double y= triangle.Area(a, b, c);
Console.WriteLine("這個三角形的周長是{0}",x);
Console.WriteLine("這個三角形的面積是{0}",y);
}
else
{
Console.WriteLine("這三條線段不能組成三角形");
}
}
}
class Triangle
{
int b1;
int b2;
int b3;
public int B1
{
get { return b1; }
set { b1 = value; }
}
public int B2
{
get { return b2; }
set { b2 = value; }
}
public int B3
{
get { return b3; }
set { b3 = value; }
}
public bool IsTriangle(int a, int b, int c)
{
if ((a + b > c) && (a + c > b) && (b + c > a))
{
return true;
}
else
{
return false;
}
}
public int Girth(int a, int b, int c)
{
int Sum = a + b + c;
return Sum;
}
public double Area(int a, int b, int c)
{
double p = (a + b + c) / 2;
double S = Math.Sqrt((p * (p - a) * (p - b) * (p - c)));
return S;
}
我估計你應該已經弄懂了,我就初學C#拿來練練手
各位高手有空可以指點指點
uj5u.com熱心網友回復:
啊 為什么要傷害我的脖子轉載請註明出處,本文鏈接:https://www.uj5u.com/net/97721.html
標籤:C#
上一篇:C# 執行緒
