HW14: Classroom reservation system

Problem statement

Implement a smart contract for classroom reservations.

Example scenario

Alice is an administrator at BME. She creates an instance of this contract to manage access to one of the rooms on campus.

Professor Bob reserves the time slot between 10:00am and 11:00am. However, Bob realizes that he reserved the wrong time, so he drops this reservation and makes a new one for the time slot between 02:00pm and 03:00pm.

At 02:00pm, Bob scans the QR code of his Ethereum address at the QR code scanner next to the room. The university's reservation system verifies that Bob has reserved the room and proceeds to open the door for him.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract ClassroomReservations {

    // <contract_variables>

    // </contract_variables>

    function ClassroomReservations() public {
        // TODO
    }

    function registerTeacher(address teacher) public {
        // TODO
    }

    function reserve(uint24 slotId) public {
        // TODO
    }

    function dropReservation(uint24 slotId) public {
        // TODO
    }

    function validate(address teacher) public view returns (bool) {
        // TODO
    }

}