progs/lecture3.scala
changeset 194 060b081523de
parent 178 fdf77ee57cdc
child 217 e689375abcc1
equal deleted inserted replaced
193:ae307c3de4ee 194:060b081523de
   128 case object Thursday extends Day 
   128 case object Thursday extends Day 
   129 case object Friday extends Day 
   129 case object Friday extends Day 
   130 case object Saturday extends Day
   130 case object Saturday extends Day
   131 case object Sunday extends Day 
   131 case object Sunday extends Day 
   132 
   132 
       
   133 abstract class Suit
       
   134 case object Spades extends Suit
       
   135 case object Hearts extends Suit
       
   136 case object Diamonds extends Suit
       
   137 case object Clubs extends Suit
       
   138 
       
   139 //define function for colour of suits
       
   140 
       
   141 abstract class Rank
       
   142 case class Ace extends Rank
       
   143 case class King extends Rank
       
   144 case class Queen extends Rank
       
   145 case class Jack extends Rank
       
   146 case class Num(n: Int) extends Rank
       
   147 
       
   148 //define functions for beats
       
   149 //beats Ace _ => true
       
   150 //beats _ Acs => false
   133 
   151 
   134 
   152 
   135 // ... a bit more useful: Roman Numerals
   153 // ... a bit more useful: Roman Numerals
   136 
   154 
   137 abstract class RomanDigit 
   155 abstract class RomanDigit