Advertisement
BloodMoonYTC

Hatszog

Oct 20th, 2021
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace hexagon
  4. {
  5.     class hatszog
  6.     {
  7.         double a;
  8.  
  9.         public hatszog (double a)
  10.             {
  11.                 this.a = a;
  12.             }
  13.         public double A
  14.         {
  15.             get { return a; }
  16.             set { a = value; }
  17.         }
  18.         public double Hterulet(double a)
  19.         {
  20.               return ((3 * Math.Sqrt(3) * (a* a)) / 2);    
  21.         }
  22.         public double Hkerulet(double a)
  23.         {
  24.             return (6 * a);
  25.         }
  26.     }
  27.     class Program
  28.     {
  29.         static void Main(string[] args)
  30.         {
  31.             Console.WriteLine("Ird be az A értékét: ");
  32.             double a = double.Parse(Console.ReadLine());
  33.             hatszog h1 = new hatszog(a);
  34.  
  35.             Console.WriteLine("A hatszög területe: {0}", h1.Hterulet(a));
  36.             Console.WriteLine("A hatszög kerülete: {0}", h1.Hkerulet(a));
  37.         }
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement