Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Determine number of classes to be used

, 22 Feb 2011
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)

About the Author

wajih1990

United States United States
No Biography provided

Comments and Discussions

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

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.8.140721.1 | Last Updated 22 Feb 2011
Article Copyright 2011 by wajih1990
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid