Here is the code: namespace Test { class DemoScout { static void Main() { GirlSc
ID: 3647917 • Letter: H
Question
Here is the code:namespace Test
{
class DemoScout
{
static void Main()
{
GirlScout objScout1 = new GirlScout();
objScout1.Name = "YYYYY";
objScout1.TroopNumber = "1211";
objScout1.DuesOwed = 2111.12;
GirlScout objScout2 = new GirlScout("XXX", "232", 123.23);
//Displaying Scout 1
Console.WriteLine("Scout 1");
Console.WriteLine("Name : " + objScout1.Name);
Console.WriteLine("Troop Number : " + objScout1.TroopNumber);
Console.WriteLine("Dues Owed : " + objScout1.DuesOwed);
Console.WriteLine("Motto : " + GirlScout.motto);
Console.WriteLine(" ");
//Displaying Scout 2
Console.WriteLine("Scout 2");
Console.WriteLine("Name : " + objScout2.Name);
Console.WriteLine("Troop Number : " + objScout2.TroopNumber);
Console.WriteLine("Dues Owed : " + objScout2.DuesOwed);
Console.WriteLine("Motto : " + GirlScout.motto);
Console.Read();
}
}
Here are the errors. The solution you did for the last part cleared up every error so if you can please tell me which code cleaner to use. Thanks for helping me.
Error 1 'Test.GirlScout' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'Test.GirlScout' could be found (are you missing a using directive or an assembly reference?) c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 12 23 Test1
Error 2 Cannot implicitly convert type 'string' to 'int' c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 13 37 Test1
Error 3 The best overloaded method match for 'Test.GirlScout.GirlScout(string, int, double)' has some invalid arguments c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 16 35 Test1
Error 4 Argument 2: cannot convert from 'string' to 'int' c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 16 56 Test1
Error 5 'Test.GirlScout' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'Test.GirlScout' could be found (are you missing a using directive or an assembly reference?) c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 20 61 Test1
Error 6 'Test.GirlScout' does not contain a definition for 'motto' c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 23 61 Test1
Error 7 'Test.GirlScout' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'Test.GirlScout' could be found (are you missing a using directive or an assembly reference?) c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 27 61 Test1
Error 8 'Test.GirlScout' does not contain a definition for 'motto' c:usersocdobbsdocumentsisual studio 2010ProjectsTest1Test1Program.cs 30 61 Test1
Explanation / Answer
Use FxCop or stylecop They will solve this problem Again the code is clean is running correctly on my laptop