CS311 Lab 2: Racing Squirrels
Complete lab2problem.cpp from the class examples area. When complete, it should print out 9 lines, each with the result of a squirrel race. A few notes:
- You can figure out the UI from how the squirrel class is used in main. Basically, class Squirrel needs a constructor that takes the name, groundspeed, and treespeed for the squirrel (groundspeed comes first). It needs two methods, travelTime and getName. RaceCourse requires a constructor that takes the course name, distance along the ground, and distance through trees. It also has getName, which returns the name.
- raceSquirrels, which is provided, passes squirrels by const reference. So, all methods called on a and b need to be const as well.
- The squirrel arrays do actually make a copy of the squirrel objects. So sqlen is the number of squirrels in the squirrels array. It's nontrivial to set up the inner loop in the newer C++11 style, so that's why it's a C99-style loop.
Upload your completed C++ code to canvas.