-- 18-04-2002 A V Peterson class CARD -- A playing card with suit club, diamond, heart, or spade -- and rank in range 1 to 13 -- Value of card equals rank for rank in range 2 to 10 -- Value of jack, queen, king (ranks 11 to 13) is 10 -- Default value of ace (rank 1) is 11. creation make feature {ANY} suit : INTEGER -- club, diamond, heart, spade rank : INTEGER -- 1 to 13 make(s : INTEGER; r : INTEGER) is -- Create a card with suit s and rank r. do suit := s rank := r end -- make display is -- Display suit and rank of card. do -- suit inspect suit when 1 then io.put_character('C') -- club when 2 then io.put_character('D') -- diamond when 3 then io.put_character('H') -- heart when 4 then io.put_character('S') -- spade end -- inspect suit -- rank inspect rank when 1 then io.put_string(" A") -- ace when 11 then io.put_string(" J") -- jack when 12 then io.put_string(" Q") -- queen when 13 then io.put_string(" K") -- king else io.put_integer_format(rank,2) end -- inspect rank end -- display value : INTEGER is -- Value of a single card in blackjack do inspect rank when 1 then Result := 11 when 11, 12, 13 then Result := 10 -- jack, queen, king else Result := rank end -- inspect rank end -- value end -- class CARD