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());
}
}
} 1 1083
On Mar 8, 1:58 pm, "lumien" <hodge.ja...@gmail.comwrote:
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());
}
}
}- Hide quoted text -
- Show quoted text -
Double Post - Please Ignore This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: administrata |
last post by:
I'm programming Car Salesman Program.
It's been "3 days" learning python...
But, i got problem
Write a Car Salesman program where the user enters the base price of a
car. The program should...
|
by: Mark Rockman |
last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------
Preparing resources...
Updating references...
Performing main compilation...
error CS0583: Internal Compiler Error...
|
by: Student |
last post by:
Hi All,
I have an assignment for my Programming language project to create a
compiler that takes a C++ file as input and translate it into the C
file. Here I have to take care of inheritance and...
|
by: lumien |
last post by:
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...
|
by: kvarada |
last post by:
Hello Experts,
I am building my application on WinNT.4.0_i386_MSVC.7.1 platform. When I build the application on a stand alone machine, it builds fine. But when I build the same application from a...
|
by: Miroslaw Makowiecki |
last post by:
Where can I download Comeau compiler as a trial version?
Thanks in advice.
|
by: Dave |
last post by:
I'm having a hard time tying to build gcc 4.3.1 on Solaris using the GNU
compilers. I then decided to try to use Sun's compiler. The Sun Studio
12 compiler reports the following code, which is in...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |