EC327 2009 HW6

EC327 2009 HW6 - The race is 50 steps long At each...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EC327 Introduction to Software Engineering HW #6 – Due Monday Dec. 14, 2009 Score: [ ] Grader: [ ] Name: ___________________ BUID: ___________________ Homework guidelines: You are expected to do individual work on homework assignments. Homework should be uploaded to blackboard (please see instructions at bottom). Problem 1 [90 pts] About: Polymorphism, STL, Iterator class. Create a class Animal with a constructor which sets the name, and a virtual move() method. Prompt the user to choose two or more of the following animals: Tortoise, Hare, Chicken, Egg (assuming that an egg is an animal). Create a race between the specified animals using the Vector class template, and the Iterator class to iterate through the member objects. At each iteration call the move() function of the object, inside the move() function use a random number generator to roll a dice in order to move the animal 1-6 steps forward.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The race is 50 steps long. At each iteration you should write an appropriate message: Tortoise crawls 4 steps forward, is at step 30. Egg rolls 1 step forward, is at step 28. Announce the race results at the end. Problem 2 [10 pts] What is the answer to the age old question of which comes first, the chicken or the egg? What to hand in Please run at least two scenarios, one with three animals and one with all four. Capture your screen image into a text file, and upload your code as well as the captured output to blackboard. PLEASE MAKE SURE THAT YOU UPLOAD ONLY ONE FILE CONTAINING BOTH YOUR CODE AND YOUR OUTPUT, AND THAT YOU LABEL IT AS: FIRSTNAME_LASTNAME.(doc/pdf/txt). You must upload this by Monday Dec. 14 Midnight. Resources Please use the resources available at this websites to help with your assignment: http://www.cplusplus.com/doc/tutorial/...
View Full Document

This note was uploaded on 11/09/2010 for the course ECE 327 taught by Professor Babakkia during the Fall '09 term at BU.

Ask a homework question - tutors are online