BojidarDosev

zad

Oct 11th, 2021 (edited)
1,000
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp11
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Main(string[] args)
  13.         {
  14.             Circle k1 = new Circle(0, 0, 7);
  15.             Point p1 = new Point(0, 7);
  16.             double d = Math.Sqrt((k1.X - p1.X) * (k1.X - p1.X) + (k1.Y - p1.Y) * (k1.Y - p1.Y));
  17.             if (d < k1.R) Console.WriteLine("tochkata e v kruga");
  18.             else if (d == k1.R) Console.WriteLine("tochkata e na okrujnostta");
  19.             else Console.WriteLine("tochkata e izvun okrujnostta");
  20.         }
  21.  
  22.     }
  23.     class Point
  24.     {
  25.         private double x;
  26.  
  27.         public double X
  28.         {
  29.             get { return x; }
  30.             set { x = value; }
  31.         }
  32.         private double y;
  33.  
  34.         public double Y
  35.         {
  36.             get { return y; }
  37.             set { y = value; }
  38.         }
  39.         public Point(double x, double y)
  40.         {
  41.             this.x = x;
  42.             this.y = y;
  43.         }
  44.     }
  45.     class Circle : Point
  46.     {
  47.         private double r;
  48.  
  49.         public double R
  50.         {
  51.             get { return r; }
  52.             set { r = value; }
  53.         }
  54.  
  55.         public static double FormulaC(double r)
  56.         {
  57.             double c = 2 * r * Math.PI; return c;
  58.  
  59.         }
  60.         public static double FormulaS(double r)
  61.         {
  62.             double s = r * r * Math.PI; return s;
  63.         }
  64.  
  65.         public Circle(double x, double y, double r) : base(x, y)
  66.         {
  67.             this.r = r;
  68.            
  69.  
  70.         }
  71.     }
  72. }
Add Comment
Please, Sign In to add comment