The Gary class is subject to C++ unit testing and therefore has stricter requirements for composition....

70.2K

Verified Solution

Question

Programming

The Gary class is subject to C++ unit testing and therefore hasstricter requirements for composition. Each required memberfunction will be denoted. (

1) Gary shall be constructed with a parameterized constructoraccepting an unsigned integer input parameter representing the sizeof the board (denote here as BoardSize). Assume that BoardSize isodd! Gary shall initialize his position to be the middle cell ofthe board, e.g., if the BoardSize is given as 5 Gary would beinitialized at index (2,2).

(2) Gary shall contain public member functions which return anunsigned integer type and accept no input named Gary::get_row() andGary::get_col() which return Gary's row and column position on theboard respectively.

(3) Gary shall contain a public member function which returnstype void and accepts a Cell pointer called Gary::move(Cell*) whichshall (a) alter Gary's orientation based on the Cell's color (b)change the Cell's color (c) move Gary one unit forward in the neworientation

(4) Gary shall contain a public member function which returnstype orientation (defined as an enumeration enum orientation {up,right, down, left};) and accepts no input parameters calledGary::get_orientation()

Answer & Explanation Solved by verified expert
3.7 Ratings (603 Votes)
Working code implemented in C and appropriate comments provided for better understanding Here I am    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students