TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prime b
NA
810
346k
Another problem with constructors
Feb 1 2012 9:51 PM
Create a class named GirlScout that contains fi elds for a
GirlScout's name, troop number, and dues owed. Include
a constant static fi eld that contains the last words of the
GirlScout motto ("to obey the Girl Scout law"). Include
overloaded constructors that allow you to set all three nonstatic
GirlScout fi elds to default values or to parameter
values. Also include properties for each fi eld. Create a class
named DemoScouts that instantiates two GirlScout objects
and displays their values. Create one object to use the default
constructor and the other to use the constructor that requires
arguments. Also display the GirlScout motto.
This is what I have done so far ( something tells me its completely wrong).
class GirlScout
{
string girlName;
int troopNumber;
double duesOwed;
static const string GIRL_SCOUT_MOTTO = "to obey the Girl Scout Law";
public GirlScout()
{
}
public GirlScout(string name)
{
girlName = name;
}
public GirlScout(int number)
{
troopNumber = number;
}
public GirlScout(double dues)
{
duesOwed = dues;
}
}
****************************
class DemoClass
{
GirlScout girl1 = new GirlScout(2);
GirlScout girl2 = new GirlScout(2.25);
static void Main(string[] args)
{
}
Reply
Answers (
1
)
Classes and private methods....
assert()