using System;
using System.Collections.Generic;
using System.Linq; using System.Text;
Using System. The Threading. The Tasks;
The implementation of the namespace interface
{
Interface IShape
{
Int Length {get; set; }
Int Width {get; set; }
Void GetArea (); }
The class Test: IShape
{
Public int chang {get; set; }
Public int kuan {get; set; }
Public int Length
{
The get {return Length; }
The set {Length=value; }
}
Public int Width
{
The get {return Width; }
The set {Width=value; }
}
Public void GetArea ()
{
Console. WriteLine (" the area of the rectangle: {0} ", chang * kuan);
}
Class Program
{
The static void Main (string [] args)
{
Console. WriteLine (" please enter the rectangular wide: ");
Var widthStr=Console. ReadLine (); Console. WriteLine (" please enter a long rectangular: ");
Var lengthStr=Console. ReadLine ();
The Test getArea=new Test (); Console. WriteLine (" the area of the rectangle: {0} ", getArea ()); The Console. ReadLine (); The Convert. ToInt32 (Console. ReadLine ()); }
}
}
}
CodePudding user response:
The Test getArea=new Test () {chang=int. Parse (lengthStr), kuan=int. J Parse (widthStr)}};GetArea. GetArea ();
CodePudding user response: