Advertisement
KodingKid

Making shapes in C#

Apr 5th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2. namespace RectangleApplication {
  3.    class Rectangle {
  4.       double length;
  5.       double width;
  6.       public void Acceptdetails() {
  7.           length = 5
  8.           width = 4
  9.           }
  10.        public double GetArea() {
  11.          return length * width;
  12.       }
  13.       public void Display() {
  14.          Console.WriteLine("Length: {0}", length);
  15.          Console.WriteLine("Width: {0}", width);
  16.          Console.WriteLine("Area: {0}", GetArea());
  17.       }
  18.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement