Working in pairs, create and test-drive the following functions:
-
Given two arrays:
prices = [ 1.23, 6.98, 8.43, 2.45 ] costs = [ 4.23, 1.12, 0.52, 8.67 ]
##Weekend Homework | |
###Card Game | |
This weekend's homework is to model a basic card game and implement the rules. | |
We aren't looking for a running game, just good TDD to demonstrate that the game works as it should. | |
####Part A - Highest Card | |
Build a simple card game that deals one card to every player and the player with the highest card wins. |
Homework Create your own class with an internal collection of a different class. It should have methods for count, add, isFull etc. Remember to write tests for your classes!
Some examples:
A Bus class with an array, passengers of Persons. A Classroom class with an array, students of Persons. A Library class with an array, stock, of Books. Extensions:
Create your own class with an internal collection of a different class. It should have methods for count
, add
, isFull
etc. Remember to write tests for your classes!
Bus
class with an array, passengers
of Person
s.Classroom
class with an array, students
of Person
s.Library
class with an array, stock
, of Book
s.Go and write tests for the rest of the methods in the Robot
class, and them implement them:
double checkBattery()
String makeDrink (String drink)
String washDishes()
This lab is to model a basic card game and implement the rules.
We aren't looking for a running game, just good TDD to demonstrate that the game works as it should.
Build a simple card game that deals one card to every player and the player with the highest card wins.
We have a bunch of information about a set of friends. We're going to find out some interesting information about them using TDD.
We need to to complete the tasks in the comments of the friends_spec.rb
file.
Write your tests in that file first, then write the function to pass the test in friends.rb
.
There is one example test and function already.
In this lab, we'd like you to make some classes of your own. Below we've outlined a few scenarios to be modelled as Classes. Throughout each part stick to using our Test Driven Development process of writing our tests first then writing our methods and refactoring until they pass.
# SQL Homework | |
The Dominion Cinema are having a Marvel Movie Marathon! They have asked you to help maintain their database of movies with times and attendees. | |
## To access the database: | |
First, create a database called 'marvel' | |
``` | |
# terminal |