Click here to Skip to main content
12,303,230 members (74,173 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

2K views
1 bookmarked
Posted

Determine number of classes to be used

, 22 Feb 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Create class Player with following attributes:string Name// Below are skills for a cricket player valid range for a skill is 1 to 10int Battingint Bowlingint Fieldingint Running // Valid range 0.00 to 100.00double RunningAverage // Valid range 2.00 to 10.00double...
Create class Player with following attributes:
string Name
// Below are skills for a cricket player valid range for a skill is 1 to 10
int Batting
int Bowling
int Fielding
int Running
// Valid range 0.00 to 100.00
double RunningAverage
// Valid range 2.00 to 10.00
double BowlingAverage
//Valid range is from 0 to 15
static int playerNumber=0;

Provided Behaviors are:
private int RandomNumber(int min, int max)
{
Random random = new Random();
return random.Next(min, max);
}
private double RandomNumber()
{
Random random = new Random();
return random.NextDouble();
}


1. Create a null parameter(default) constructor to that sets player name to as “Player”+PlayerNumber and increments playerNumber static attribute, it also sets player skills attributes to random values.
2. Create a constructor that takes player’s name as parameter and fill reset of the values randomly.
3. create a constructor that takes all player’s name and batting skills as parameters and fills rest of the attributes randomly
4. Create a constructor that takes player’s name and bowling skills as parameters and fills rest randomly
5. Create a behavior / method displaySmary() that display player’s Name and summary of his skills
6. Create several players by using different constructors you have created and call displaySummary() method. how we make this programme

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

wajih1990
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralWhy did you send this to me privately? If you think that I a... Pin
Richard MacCutchan23-Feb-11 7:33
mvpRichard MacCutchan23-Feb-11 7:33 
GeneralReason for my vote of 1 Please remove this "tip". It is your... Pin
Marcus Kramer22-Feb-11 7:08
memberMarcus Kramer22-Feb-11 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160530.1 | Last Updated 22 Feb 2011
Article Copyright 2011 by wajih1990
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid