using System;
namespace ConsoleApplication1
{
// 矩形类
public class Rectangle
{
private float width;
private float height;
//构造函数:参数为宽度width和高度height
public Rectangle(float width, float height)
{
this.width = width;
this.height = height;
}
// 获取宽度
public float Width { get { return this.width; } }
//获取高度
public float Height { get { return this.height; } }
// 获取面积
public float Area { get { return this.width * this.height; } }
// 获取周长
public float Circumference { get { return 2 * (this.width + this.height); } }
// 用于输出
public override string ToString()
{
return string.Format("矩形的宽度:{0},高度:{1},面积:{2},周长:{3}",
Width, Height, Area, Circumference);
}
}
class Program
{
static void Main(string[] args)
{
Rectangle r1 = new Rectangle(100, 50);
Console.WriteLine(r1.ToString());
Rectangle r2 = new Rectangle(30.5f, 67.7f);
Console.WriteLine(r2.ToString());
Console.ReadLine();
}
}
}
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/6d81800a19d8bc3e7bfaed1a878ba61ea9d34574?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
追问假设图书馆的图书类Book包含书名,编号和作者名属性,读者类Reader包含姓名和借书证属性,每位读者最多可借5本书,设计他们的公共基类BClass,要求列出所有读者的借书情况,,
求代码
追答;-) it's ANOTHER question, isn't it?
追问yes,please help me!