Home > Net > C # interface implementation of the rectangular area calculation
C # interface implementation of the rectangular area calculation
Time:11-24
Why cannot display area, want to know where is wrong 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 getarea () {return Length * Width; } Public int chang {get; set; } Public int kuan {get; set; } Public int Length {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: "); The Console. ReadLine (); Console. WriteLine (" please enter a long rectangular: "); The Console. ReadLine (); The Test getarea=new Test (); Console. WriteLine (" the area of the rectangle: {0} ", getArea ()); The Convert. ToInt32 (Console. ReadLine ()); }}}}
CodePudding user response:
The content of the console input, use variables to receive