程序代写代做代考 c++ oopd-tut-2.dvi

oopd-tut-2.dvi

Object-Oriented Design and Programming Tutorial

University Challenge is a TV quiz competition featuring teams of students from
universities around the UK. You may recall that in 2009 a team from Oxford
University apparently won the competition but were then stripped of their title
because their team did not meet competition rules regarding team composition.

Suppose the rules regarding the composition of a valid University Challenge
team are as follows:

• The team must represent a single UK university and must consist of exactly
four students.

• Each team member must be registered as a student at the same university that
the team represents.

• Each team member must not be younger than 18 or older than 40.

• The average age of team members must be less than 25.

• The team must contain exactly one student who has been nominated as captain.

Note these rules must hold throughout the competition and may be checked at
any time during the competition.

a Draw a UML class diagram to describe the above.

b Write C++ class declarations (i.e. no function bodies) to support the above.

c Write a test function where:

– A University Challenge team for Imperial is created.

– Ivor Bigbrain (aged 20), a registered student at Imperial, joins the team.

– Prezza Buzza (aged 18), a registered student at Imperial, joins the team.

– Ivonna Singh (aged 25), a registered student at Imperial and nominated
captain, joins the team.

– Yuman Google (aged 32), a registered student at Imperial, joins the team.

– Prezza Buzza graduates, thereby ceasing to be a registered student at
Imperial.

– A check is carried out to determine whether or not the team meets the
competition rules regarding team composition.

d Write the bodies of the functions from part (b) that relate to your classes for
contestants and teams.