UNB/ CS/ David Bremner/ teaching/ cs2613/ assignments/ CS2613 Assignment 1

# What to hand in, and how to hand it in, and when

• Make a directory `~/cs2613/assignments/A1` (i.e. in your git repo for this class). All files related to this assigment should be saved in that directory.
• Make sure you commit and push all your work using git before 16:30h on Tuesday September 26

# Marking

• You will be marked on the last version pushed to coursegit
• You will be marked on
complete coverage is a minimum requirement
coding style
For `racket`, we follow official racket code layout. If you don't fight `DrRacket` too much, this should be easy.
correctness
Obviously your code should should do what it is supposed to.
idiomatic racket
This assignment is about structs and functions in racket; you shouldn't need anything else.
• For a detailed marking scheme, see racket-assignment

# Questions

Solve the following (Exercise 8 from FICS) using `#lang htdp/bsl`

## Part 1

Using the clock struct defined by:

``````    (define-struct clock (hours mins secs))
``````

to represent 24-hour time (midnight is 00:00:00, one second before is 23:59:59), write the function tick that consumes a clock struct `c` and produces the clock struct representing the time one second after the time represented by `c`. Use modular arithmetic (i.e. the functions `modulo`, `remainder`, and/or `quotient`)

Here are some test cases to help explain how the function should work

```(check-expect (tick (make-clock 23 59 59))
(make-clock 0 0 0))
(check-expect (tick (make-clock 23 58 59))
(make-clock 23 59 0))
(check-expect (tick (tick (make-clock 23 59 58)))
(make-clock 0 0 0))
```

## Part 2

Define a second function `tick*` that does the same thing (in particular passes all of the same tests) as `tick`, but does not use modular arithmetic.