L
lumien
When using the following code, I get the error "The type
"ConsoleApplication1.robot" already contains a definition for
'color"". I also get the error for "height".
If anyone could point me to the answer to this issue or documentation
describing what I am doing incorrectly I would appreciate it.
Thanks,
Jason
****Code****
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class robot
{
/* Defining robot attributes */
private string color;
private double height;
/* sets robot color */
public string color
{
get {return this.color; }
set {this.color = value; }
}
/* sets robot height */
public double height
{
get {return this.height; }
set { this.height = value; }
}
/* Create Object
<param color => color of robot </param>
<param height => height of robot </param>
*/
public robot(String color, Double height)
{
this.color = color;
this.height = height;
}
/* calculates weight based on height */
public double weight()
{
return 5 * this.height;
}
/*overloads ToString */
public string ToString()
{
return string.Format("{0,-20},{1,-10},{2,-10F1}",
this.color, this.height, this.weight());
}
}
}
"ConsoleApplication1.robot" already contains a definition for
'color"". I also get the error for "height".
If anyone could point me to the answer to this issue or documentation
describing what I am doing incorrectly I would appreciate it.
Thanks,
Jason
****Code****
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class robot
{
/* Defining robot attributes */
private string color;
private double height;
/* sets robot color */
public string color
{
get {return this.color; }
set {this.color = value; }
}
/* sets robot height */
public double height
{
get {return this.height; }
set { this.height = value; }
}
/* Create Object
<param color => color of robot </param>
<param height => height of robot </param>
*/
public robot(String color, Double height)
{
this.color = color;
this.height = height;
}
/* calculates weight based on height */
public double weight()
{
return 5 * this.height;
}
/*overloads ToString */
public string ToString()
{
return string.Format("{0,-20},{1,-10},{2,-10F1}",
this.color, this.height, this.weight());
}
}
}