Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The first part of my program is still giving me errors as listed below. The seco

ID: 3647922 • Letter: T

Question

The first part of my program is still giving me errors as listed below. The second part, the class GirlScout is error free...posted below. Can you run the FXCop on the first part? I downloaded it but an confused on how to set it up properly.
First part code:
using System;
using System.Collections.Generic;
using System.Text;

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();

}
}
First part errors:
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:usersocdobbsdocuments isual studio 2010ProjectsTest1Test1Program.cs 12 23 Test1
Error 2 Cannot implicitly convert type 'string' to 'int' c:usersocdobbsdocuments isual 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:usersocdobbsdocuments isual studio 2010ProjectsTest1Test1Program.cs 16 35 Test1
Error 4 Argument 2: cannot convert from 'string' to 'int' c:usersocdobbsdocuments isual 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:usersocdobbsdocuments isual studio 2010ProjectsTest1Test1Program.cs 20 61 Test1
Error 6 'Test.GirlScout' does not contain a definition for 'motto' c:usersocdobbsdocuments isual 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:usersocdobbsdocuments isual studio 2010ProjectsTest1Test1Program.cs 27 61 Test1
Error 8 'Test.GirlScout' does not contain a definition for 'motto' c:usersocdobbsdocuments isual studio 2010ProjectsTest1Test1Program.cs 30 61 Test1

Second part error free...
class GirlScout
{
public const string GIRL_SCOUT_MOTTO = "to obey the Girl Scout Law";

string girlName;
int troopNumber;
double duesOwed;


public string GirlName
{
get { return girlName; }
set { girlName = value; }
}

public int TroopNumber
{
get { return troopNumber; }
set { troopNumber = value; }
}

public double DuesOwed
{
get { return duesOwed; }
set { duesOwed = value; }
}


public GirlScout(string name, int number, double dues)
{
girlName = name;
troopNumber = number;
duesOwed = dues;
}

public GirlScout()
: this("Brownie", 1, 0.0)
{
}

public override string ToString()
{
return String.Format("Name {0}, Troop Number {1}, Dues Owed {2:C}", girlName, troopNumber, duesOwed);
}
}

class DemoScouts
{
static void Main(string[] args)
{
GirlScout girl1 = new GirlScout();
Console.WriteLine(girl1);
GirlScout girl2 = new GirlScout("Angela", 2, 2.25);
Console.WriteLine(girl2);
Console.WriteLine("Our motto is : '{0}'", GirlScout.GIRL_SCOUT_MOTTO);
Console.ReadKey();
}
}
}

Explanation / Answer

class GirlScout { public const string GIRL_SCOUT_MOTTO = "to obey the Girl Scout Law"; string girlName; int troopNumber; double duesOwed; public string GirlName { get { return girlName; } set { girlName = value; } } public int TroopNumber { get { return troopNumber; } set { troopNumber = value; } } public double DuesOwed { get { return duesOwed; } set { duesOwed = value; } } public GirlScout(string name, int number, double dues) { girlName = name; troopNumber = number; duesOwed = dues; } public GirlScout() : this("Brownie", 1, 0.0) { } public override string ToString() { return String.Format("Name {0}, Troop Number {1}, Dues Owed {2:C}", girlName, troopNumber, duesOwed); } } class DemoScouts { static void Main(string[] args) { GirlScout girl1 = new GirlScout(); Console.WriteLine(girl1); GirlScout girl2 = new GirlScout("Angela", 2, 2.25); Console.WriteLine(girl2); Console.WriteLine("Our motto is : '{0}'", GirlScout.GIRL_SCOUT_MOTTO); Console.ReadKey(); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote