namespace Lecture._6.Sample._1
public static class Checker
public static bool IsLanded(float x, float y)
if (y < 0)return true; else return false;
private List<float> x; private List<float> vx;
private List<float> y; private List<float> vy;
public ThrownBody(float x, float y, float v, float deg)
if (deg <=0 || deg >= 180)
throw new Exception("CREATING OBJECT OF FlyingBody IS FAILED DUE TO ANGLE");
deg = (float)((deg * Math.PI) / 180);
this.x = new List<float>(); this.y = new List<float>();
this.vx = new List<float>(); this.vy = new List<float>();
this.x.Add(x); this.vx.Add((float)(v * Math.Cos(deg)));
this.y.Add(y); this.vy.Add((float)(v * Math.Sin(deg)));
if (x.Count == 0 || vx.Count == 0) return true;
if (y.Count == 0 || vy.Count == 0) return true;
return Checker.IsLanded(x[x.Count - 1], y[y.Count - 1]);
public void Next(float dt)
{ if (object.ReferenceEquals(this.x, null)) return;
if (object.ReferenceEquals(this.y, null)) return;
if (object.ReferenceEquals(this.vx, null))return;
if (object.ReferenceEquals(this.vy, null))return;
if (x.Count == 0 || vx.Count == 0) return;
if (y.Count == 0 || vy.Count == 0) return;
if (Count!= y.Count || vx.Count != Count || vy.Count != Count)
Console.WriteLine("Код ошибки: 001. Итерация прервано..."); return;
this.vx.Add(this.vx[this.vx.Count - 1]);
this.vy.Add(this.vy[this.vy.Count - 1] - 9.8f*dt);
this.x.Add(this.x[this.x.Count - 1] + this.vx[this.vx.Count - 1] * dt);
this.y.Add(this.y[this.y.Count - 1] + this.vy[this.vy.Count - 1] * dt);
public void Throw(float dt)
Console.WriteLine("FLIGHT IS STARTED...");
while (!IsLanded()) Next(dt);
Console.WriteLine("FLIGHT IS COMPLETED!");
{ if (this.x.Count != this.y.Count)
{ Console.WriteLine("NOT POSSIBLE TO SHOW DATA!"); }
for( int i = 0; i < this.x.Count; i++ )
Console.WriteLine("x = {0};y = {1}", x[i], y[i]);
static void Main(string[] args)
ThrownBody Body1 = new ThrownBody(0, 0, 10, 45);