I have this code ( C#): there is an error, as in attached, What is the problem? >>>>>>>>>>>>>>>>>>>>>>>>>>>> using System; public class Rectangle { double width, length, coorx, coory; public Rectangle() { width = 1; length = 1; coorx = 0; coory = 0; } public void move(double x, double y) { coorx += x; coory += y; } public double getArea() { return width * length; } public double getPerimeter() { return 2 * (width + length); } public override string ToString() { return "Rectangle with width: " + width.ToString() + ", length: " + length.ToString() + " with its center at : (" + coorx.ToString() + ", " + coory.ToString() + ")\n"; } public static void Main() { Rectangle[] arr = new Rectangle[2]; arr[0] = new Rectangle(); arr[1] = new Rectangle(3,4,0,0); Console.WriteLine(arr[0]); Console.WriteLine(arr[1]); arr[0].move(1, 1); Console.WriteLine(arr[0]); Console.WriteLine(arr[0].getArea()); Console.WriteLine(arr[0].getPerimeter()); Console.WriteLine(arr[1].getArea()); Console.WriteLine(arr[1].getPerimeter()); } }
I have this code ( C#):
there is an error, as in attached, What is the problem?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
using System;
public class Rectangle
{
double width, length, coorx, coory;
public Rectangle()
{
width = 1;
length = 1;
coorx = 0;
coory = 0;
}
public void move(double x, double y)
{
coorx += x;
coory += y;
}
public double getArea()
{
return width * length;
}
public double getPerimeter()
{
return 2 * (width + length);
}
public override string ToString()
{
return "Rectangle with width: " + width.ToString() + ", length: " + length.ToString() + " with its center at : (" + coorx.ToString() + ", " + coory.ToString() + ")\n";
}
public static void Main()
{
Rectangle[] arr = new Rectangle[2];
arr[0] = new Rectangle();
arr[1] = new Rectangle(3,4,0,0);
Console.WriteLine(arr[0]);
Console.WriteLine(arr[1]);
arr[0].move(1, 1);
Console.WriteLine(arr[0]);
Console.WriteLine(arr[0].getArea());
Console.WriteLine(arr[0].getPerimeter());
Console.WriteLine(arr[1].getArea());
Console.WriteLine(arr[1].getPerimeter());
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
![2 references
public double getPerimeter()
{
return 2 * (width + length);
}
O references
public override string ToString()
{
return "Rectangle with width: " + width.ToString) + ", length: " + length.ToString() + " with its center a
O references
public static void Main(O
{
Rectangle[] arr = new Rectangle[2];
arr[0] = new Rectangle);
arr[1] = new Rectangle(3,4,0,0);
Console.WriteLine(arr[0]);
Console.WriteLine(arr[1]);
arr[0].move(1, 1);
Console.WriteLine(arr[0]);
Console.WriteLine(arr[0].getArea());
Console.WriteLine(arr[0].getPerimeter());
Console.WriteLine(arr[1].getArea());
Console.WriteLine(arr[1].getPerimeter());](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6d6f7b0c-001f-4fe5-90f1-f56c850b2d13%2F8adc8175-d1ea-4a94-ad2d-c08518771e1a%2Fq924cqe_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)