Click here to Skip to main content
Click here to Skip to main content

Determine number of classes to be used

By , 22 Feb 2011
 
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
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralWhy did you send this to me privately? If you think that I a...mvpRichard MacCutchan23 Feb '11 - 7:33 
Why did you send this to me privately? If you think that I am going to do your homework for you then you are sadly mistaken.
GeneralReason for my vote of 1 Please remove this "tip". It is your...memberMarcus Kramer22 Feb '11 - 7:08 
Reason for my vote of 1
Please remove this "tip". It is your homework question and does not belong here.

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 22 Feb 2011
Article Copyright 2011 by wajih1990
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid