Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OBJECTORIENTATEDCODE
- {
- class Program
- {
- static void Main(string[] args)
- {
- Shape sqaure = new Shape()
- {
- numberofsides = 4,
- sidelength = 2,
- regular = true,
- };
- sqaure.getperimeter();
- sqaure.getarea();
- }
- }
- class Shape
- {
- public int numberofsides;
- public int sidelength;
- public bool regular;
- public void getperimeter()
- {
- // Console.WriteLine("Number of sides " + this.numberofsides);
- // Console.WriteLine("Side length " + this.sidelength);
- // Console.WriteLine("Regular? " + this.regular);
- Console.WriteLine(this.sidelength * this.numberofsides);
- }
- public void getarea()
- {
- Console.WriteLine(this.sidelength * 2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement