www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# CS304 Assignment No 03 Fall 2019 Solution & Discussion

CS304 Assignment No 03 Fall 2019 Solution & Discussion

Views: 895

### Replies to This Discussion

Cs 304 assignment Solution
#include <iostream>
#include <string>
using namespace std;
class Player{
private:
string name;
string code;
int Age;
public:
Player()
{
//………….
}
void setname()
{
cout"\nEnter Name: ";
cin>>name;
}
void setcode()
{
cout" Enter PlayerCode: ";
cin>> code;
}
void setAge()
{
cout" Enter Age: ";
cin>> Age;
}
string getname()
{
return name;
}
string getcode()
{
return code;
}
int getAge()
{
return Age;
}
void display()
{
// Display function for Player Class….
}
};
class Batsman:public Player{
private:
int Inning;
int Scored;
double B_Average;
public:
Batsman()
{
//………….
}
void setInning()
{
cout"Enter Inning: ";
cin>>Inning;
}
void setScored()
{
cout"Enter Runs: ";
cin>>Scored;
}
double cal_Average()
{
return B_Average = Scored/Inning;
}
virtual void display()
{
cout"\nDisplaying Batsman Information:\n..........................\n";
cout"Batsman name: "getname()endl;
cout"Batsman code: "getcode()endl;
cout"Batsman age: "getAge()endl;
cout"Batsman Average: "cal_Average()endl;
}
};
class Bowler:public Player{
private:
int Run, Over;
double L_Average;
public:
Bowler()
{
//.......
}
void setRun()
{
cout"Enter Runs Conceded: ";
cin>>Run;
}
void setOver()
{
cout"Enter Total Overs: ";
cin>>Over;
}
double cal_Average()
{
return L_Average = Run/Over;
}
virtual void display()
{
cout"\nDisplaying Bowler information:\n..........................";
cout"Bowler name: "getname()endl;
cout"Bowler code: "getcode()endl;
cout"Bowler age: "getAge()endl;
cout"Bowler Average: "cal_Average()endl;
}
};

int main()
{
int size, i;
char arr[size], check;
Batsman batsman;
Bowler bowler;

cout" How many Bowlers and Batsman data you want to enter? ";
cin>>size;

while(i<size)
{
cout"\nEnter choi

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

54 minutes ago

1 hour ago

1 hour ago

1 hour ago

### @@@@ Mera dill bra roya h;;;;;

1 hour ago
+ Diamond Heart liked 刀のの尺's discussion (っ◔◡◔)っ ♥ Conversation ♥
1 hour ago
+ Diamond Heart liked Asrukh's discussion Mit chuki hai meri har khushi,
1 hour ago
1 hour ago