We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Looking for Something at Site? Search Below

CS304 Assignment No 03 Fall 2019 Solution & Discussion


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 687

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided. 

 

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

 

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

Click Here to Search (Looking For something at vustudents.ning.com?)

Click Here to Join (Our facebook study Group)

Any one wants to read  cs304 free  

contact me rameeza.nida

G me read krna chahta hn cs304

#include
#include
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
{
cout"\nEnter choice: B for batsman, L for Bowler: "endl;
cin>>arr[i];
if(arr[i] == 'b' || arr[i] == 'B')
{
cout"\nEnter following data for Batsman: "endl;
batsman.setname();
batsman.setcode();
batsman.setAge();
batsman.setInning();
batsman.setScored();
}
if(arr[i]=='l' || arr[i]== 'L' )
{
cout"\nEnter following data for bowler: "endl;
bowler.setname();
bowler.setcode();
bowler.setAge();
bowler.setOver();
bowler.setRun();
}
cout"\nDo you want to enter more data (Y for yes, N for No): ";
cin>>check;
if(check=='n' || check =='N' || i==size-1)
{
for (i=0; i
{
if(arr[i] =='B' || arr[i] == 'b')
{
batsman.display();
}
if(arr[i] == 'L' || arr[i] == 'l')
{
bowler.display();
}
}
}
i++;
}
}

wrong code hai error dy raha hai

#include
#include
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
{
cout"\nEnter choice: B for batsman, L for Bowler: "endl;
cin>>arr[i];
if(arr[i] == 'b' || arr[i] == 'B')
{
cout"\nEnter following data for Batsman: "endl;
batsman.setname();
batsman.setcode();
batsman.setAge();
batsman.setInning();
batsman.setScored();
}
if(arr[i]=='l' || arr[i]== 'L' )
{
cout"\nEnter following data for bowler: "endl;
bowler.setname();
bowler.setcode();
bowler.setAge();
bowler.setOver();
bowler.setRun();
}
cout"\nDo you want to enter more data (Y for yes, N for No): ";
cin>>check;
if(check=='n' || check =='N' || i==size-1)
{
for (i=0; i
{
if(arr[i] =='B' || arr[i] == 'b')
{
batsman.display();
}
if(arr[i] == 'L' || arr[i] == 'l')
{
bowler.display();
}
}
}
i++;
}
}

CS304 Object Oriented Programming Assignment 3 Solution & Discussion Fall 2019


 

Solution Idea:

 

#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 choice: B for batsman, L for Bowler: "endl;
cin>>arr[i];

if(arr[i] == 'b' || arr[i] == 'B')
{
cout"\nEnter following data for Batsman: "endl;
batsman.setname();
batsman.setcode();
batsman.setAge();
batsman.setInning();
batsman.setScored();
}
if(arr[i]=='l' || arr[i]== 'L' )
{
cout"\nEnter following data for bowler: "endl;

bowler.setname();
bowler.setcode();
bowler.setAge();
bowler.setOver();
bowler.setRun();
}
cout"\nDo you want to enter more data (Y for yes, N for No): ";
cin>>check;

if(check=='n' || check =='N' || i==size-1)
{
for (i=0; i<size; i++)
{
if(arr[i] =='B' || arr[i] == 'b')
{
batsman.display();
}
if(arr[i] == 'L' || arr[i] == 'l')
{
bowler.display();
}
}
}
i++;
}

}

CS304 Assignment 3 Solution & Discussion Fall 2019


 

Execute Online --> http://cpp.sh/87li4

cs304 assignment solution with explanation

*************

Email, cell no, facebook personal links, links sharing for promotion any kind of site & youtube direct link sharing is not allowed at the site.

 

Although If you want to share the youtube video, then paste the embed codes here of the youtube video. Otherwise your comment / reply will be deleted. As well as your account will be deleted from the site. Thanks for understanding.

CS304 Solution Assignment No 03 Fall 2019

below link 

CS304_Assignmnet_03_Solution_Fall_2019_vustudents.ning.com.cpp

RSS

HELP SUPPORT

This is a member-supported website. Your contribution is greatly appreciated!

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.