HW06: Checking/Savings

Problem statement

Implement a smart contract for personal finance management.

Example scenario

Alice creates a contract with 10 ether initial balance. The initial balance of her checking account is 9 ether, while that of the savings account is 1 ether. Every month, Alice transfers her salary to the contract. Anytime Alice needs money, she withdraws from her checking account. After 1 year, she can freely withdraw from her savings account too.

Contract interface

Contract skeleton

pragma solidity ^0.4.21;

contract CheckingSavings {

    // <contract_variables>

    // </contract_variables>

    function CheckingSavings() public payable {
        // TODO
    }

    function withdrawChecking(uint256 amount) public {
        // TODO
    }

    function withdrawSavings(uint256 amount) public {
        // TODO
    }

    function () public payable {
        // TODO
    }

}