PracticalExamWinter2011.pdf - COMP 30070 Practical Examination Winter 2011 Attempt parts 1 to 4 in sequence Only one Ruby program should be submitted

PracticalExamWinter2011.pdf - COMP 30070 Practical...

This preview shows page 1 - 2 out of 2 pages.

COMP 30070 Practical Examination Winter 2011 Attempt parts 1 to 4 in sequence. Only one Ruby program should be submitted finally. Aim to get each part working correctly before moving on to the next. The bulk of the marks will be awarded for how much you get working, so be sure to submit a working solution, commenting out sections of code if necessary. Marks are also awarded for clear design and coding, indentation and (light) commenting. You may write your program in one .rb file if you wish (the simplest approach), or use several .rb files. Test cases should be developed and submitted as you see fit, but only one test case per class is all that is required for full marks. 1.Write a class Cardthat represents a card from a normal 52-card pack of playing cards. It stores the suit(one of Diamonds, Hearts, Clubs, Spades) and the kind(Two, Three, ..., Ten, Ace, King, Queen, Jack) of the card. Write a method to_sthat returns a string that represents the card, e.g., “TEN of SPADES”. Using the class Card

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture