Class Не содержит конструктор - C#
Формулировка задачи:
Ребят.Помогите найти в чем ошибка.
//Вычислить y. using System; namespace ConsoleApplication23 { class Program { class sk1 { double x1, y1; public sk1(double x, double y) { x1 = x; y1 = y; } public double x { get { return x1; } set { x1 = value; } } public double y { get { return y1; } set { y1 = value; } } public double Input(string p) { Console.Write(p); return Convert.ToDouble(Console.ReadLine()); } public void check() { if (x < 0 || y < 0 || (x + Math.Sqrt(y)) < 0) { Console.WriteLine("Решений нет"); } else Console.WriteLine("y={0:f2}", -5 * (Math.Sqrt(x + Math.Sqrt(y)))); } } static void Main(string[] args) { sk1 qq = new sk1(); qq.x = qq.Input("Введите x: "); qq.y = qq.Input("Введите y: "); qq.check(); Console.ReadKey(); } } }
Проблему решил.
//Вычислить y. using System; namespace ConsoleApplication23 { class Program { class sk1 { double x1, y1; public sk1() { x1 = 0; y1 = 0; } public sk1(double x, double y) { x1 = x; y1 = y; } public double x { get { return x1; } set { x1 = value; } } public double y { get { return y1; } set { y1 = value; } } public double Input(string p) { Console.Write(p); return Convert.ToDouble(Console.ReadLine()); } public void check() { if (x < 0 || y < 0 || (x + Math.Sqrt(y)) < 0) { Console.WriteLine("Решений нет"); } else Console.WriteLine("y={0:f2}", -5 * (Math.Sqrt(x + Math.Sqrt(y)))); } } static void Main(string[] args) { sk1 qq = new sk1(); qq.x = qq.Input("Введите x: "); qq.y = qq.Input("Введите y: "); qq.check(); Console.ReadKey(); } } }
Решение задачи: «Class Не содержит конструктор»
textual
Листинг программы
public double X {set; get;} public double Y {set; get;} public sk1(double xArg, double yArg) { this.X = xArg; this.Y = yArg; }