Tajaba
Tajaba
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
ok
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
like that?
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
private int radius;
public int Radius
{
get => radius;
set => radius = value;
}
private int radius;
public int Radius
{
get => radius;
set => radius = value;
}
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
wait ill do it
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
oh
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
how to do it
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
ok
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
i didnt understand what to change in the code and where
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
i got confused fr
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
bro
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
the backing field shot be in the same class?
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
ok but in my program i get a random value for the radius
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
so how i fix it
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
got it
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
oh my english is not that good so forgive me
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
public class Circle :Shape
{
private int Radius
{
get { return Radius; }
set { if (Radius<12.5) Radius = value; }
}
public Circle()
{}

public Circle(int x, int y, ConsoleColor color, int radius) :base(x,y,color)
{
Radius = radius;
}
public override void InitWithRandomValues()
{
Random rnd = new Random();
X = rnd.Next(1, 80);
Y = rnd.Next(1, 25);
Color = (ConsoleColor)rnd.Next(Enum.GetNames(typeof(ConsoleColor)).Length);
Radius = rnd.Next(1, (int)12.5);
}
public override void Draw()
{
double angleStep = 1.0 / Radius;
Console.SetCursorPosition(X, Y);
Console.ForegroundColor = (System.ConsoleColor)color;
for (double angle = 0; angle <= 2 * Math.PI; angle += angleStep)
{
int x = (int)Math.Round(X + Radius * Math.Cos(angle));
int y = (int)Math.Round(Y + Radius * Math.Sin(angle));
Console.SetCursorPosition(x, y);
Console.Write("*");

}
}

public override double GetArea()
{
return (Math.PI * Radius * Radius);
}

public override double GetPerimeter()
{
return (2 * Math.PI * Radius);
}

public override void ShowDetails()
{
Console.Write("X" + X, "Y" + Y, "Color" + color, "Radius" + Radius + "Area" + GetArea() + "Perimeter" + GetPerimeter());

}


}
}
public class Circle :Shape
{
private int Radius
{
get { return Radius; }
set { if (Radius<12.5) Radius = value; }
}
public Circle()
{}

public Circle(int x, int y, ConsoleColor color, int radius) :base(x,y,color)
{
Radius = radius;
}
public override void InitWithRandomValues()
{
Random rnd = new Random();
X = rnd.Next(1, 80);
Y = rnd.Next(1, 25);
Color = (ConsoleColor)rnd.Next(Enum.GetNames(typeof(ConsoleColor)).Length);
Radius = rnd.Next(1, (int)12.5);
}
public override void Draw()
{
double angleStep = 1.0 / Radius;
Console.SetCursorPosition(X, Y);
Console.ForegroundColor = (System.ConsoleColor)color;
for (double angle = 0; angle <= 2 * Math.PI; angle += angleStep)
{
int x = (int)Math.Round(X + Radius * Math.Cos(angle));
int y = (int)Math.Round(Y + Radius * Math.Sin(angle));
Console.SetCursorPosition(x, y);
Console.Write("*");

}
}

public override double GetArea()
{
return (Math.PI * Radius * Radius);
}

public override double GetPerimeter()
{
return (2 * Math.PI * Radius);
}

public override void ShowDetails()
{
Console.Write("X" + X, "Y" + Y, "Color" + color, "Radius" + Radius + "Area" + GetArea() + "Perimeter" + GetPerimeter());

}


}
}
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
tried to do circle it and thats what it showed de
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
No description
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
coudlnt found it
105 replies
CC#
Created by Tajaba on 4/20/2024 in #help
OOP help with a project please
still
105 replies