0% found this document useful (0 votes)
40 views3 pages

OOP2 Lab Exam Mid

Uploaded by

marufhasan7702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

OOP2 Lab Exam Mid

Uploaded by

marufhasan7702
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Object Oriented Programming 2

Lab Exam (Mid-term)

Instructions:


Students from the ODD no. columns will answer Question 1.


Students from the EVEN no. columns will answer Question 2.

N.B. Remember to delete your downloaded question + source code from your PC before
leaving the class. You are not allowed to see any kind of resources during lab exam (not
even your class lectures/notes)
Question 1
Write a C# program for the following scenario:
A sports club in your local area decided to have a software application to manage its members.
You are a member of that club. When the club management committee came to know that you are
a very good C# developer, they approached you to develop the software. The requirement is kind
of following.
Member class has id, name and an address and a public static method called GetAllDetails which
will show all the information for a particular Member (Player/Staff). There are 2 types of special
members. i) Player and ii) Staff. Staff class has an additional field named position which can
hold the position (e.g., coach, manager, physician) and a method called PlayerStatus which will
return Players who are eligible to play next match.
Player class has additional salary, playing position (e.g., striker, mid-fielder) currentRank
(value will be 0-100%) and boolean type field playingStatus (which can be either true or false)
based on player performance which is going to select the player eligible to play next match.
When the rank of a player lies between (75-100) he will be eligible to play in the next match.
Staff need help from your system using PlayerStatus method where staff will give the information
of individual player and from there if system finds that rank of a player is between (75-100), it will
suggest he will be eligible to play the next match. After that it will show all the information
about the suggested Player and information about Staff at the end.
The Club Committee maintains all types of members. The ClubCommittee class has an array of
Member types. The AddMember(Member mem) method of this class adds a member to that
array. Members can be a player or staff. The Main method is given for you. Your job is to
implement theclasses along with the relationships.
class Program
{
static void Main(string[] args)
{
//Address(houseNO,roadNo,area,district)
Address a1 = new Address(2 , 5 , "Uttara", "Dhaka");
Address a2 = new Address(3 , 15 , "Banani", "Dhaka");

Staff s = new Staff("ST-000","BRUCE" , a1 , "Coach");

Player[] list = new Player[2];


list[0] = new Player("PL-000", "TONY" , a2 , 10000 , "Striker" , 87);
list[1] = new Player("PL-000, "CLERK" , a1 , 14000 , "Defender" , 71);

for (int i = 0; i < [Link]; i++)


{
if ([Link](list[i]) == true))
[Link](list[i]);
}
[Link](s);

ClubCommittee cc = new ClubCommittee();


[Link](s);
[Link](p1);
[Link](p2); } }
Question 2

Write a C# program for the following scenario:


In this FIFA World Cup one of the teams is going to participate in their next match and they will
need a balanced team for that. In these circumstances the head coach needs your help, and his
requirement is kind of following.
Person class has an id, name and address and a public static method called ShowDetails which
will show all the information for a particular Person (Player/Coach). There are 2 types of special
person. i) Player ii) Coach. Player class has additional fields named performanceRate(0-100%),
noofgoal and playingPosition, which can hold the position (e.g. striker, defender). Coach class
has one additional field experience (in years) and a method called PlayerStatus which will return
players those who are eligible to play next match.
The coach has already selected 9 players for next match now it’s time for him to select 2 strikers
for next match and he needs a help from your system using PlayerStatus method where coach will
give the information of individual striker and from there if system finds that performance rate of
the player is between 75-100% and number of goals is above 20 it will suggest he will be an
eligible player. After that it will show all the information about the suggested Player and also
informationof coach at the end.
There is a specific format for both player’s and coach’s id. For Players it’s PL-XXXX and coach
its SC-XXX-18. The id number needs to be auto generating. For both start the value of id from 0.
The Main method is given for you. Your job is to implement the classes along with the
relationships.

class Program
{
static void Main(string[] args)
{
Coach c = new Coach("HC","T", 4.5);
Player[] p = new Player[4];
p[0] = new Player("A","W", 87, 31, "Striker");
p[1] = new Player("B","X", 60, 38, "Striker");
p[2] = new Player("C","Y", 73, 19, "Striker");
p[3] = new Player("D","Z", 92, 47,"Striker");

for (int i = 0; i < [Link]; i++)


{
if ([Link](p[i]) == true))
[Link](p[i]);
}
[Link](c);
}
}

You might also like