Erlang Assignment

Phone Firewall

Erlang was originally designed for phone systems, so in this spirit, you'll be designing a phone simulation which "blocks" calls. To keep things simple, the program should block calls which end in an odd number and answer calls which end in an even number. Your code will have two threads, a caller and a reciever, which will communicate with each other. The caller will attempt to place the call, and the receiver will decide whether to answer or block, letting the caller know it's choice. Each of these should run on it's own thread. At each decision choice in the program, you should print out the following:

Boiler Plate

-module(calls).

%% ====================================================================
%% API functions
%% ====================================================================

-export([start/0, calling/3, answer/0,mod/2]).

mod(X,Y)->(X rem Y + Y) rem Y.

calling(0,Num, PID) ->
%.

calling(N,Num, PID) ->
%.

answer() ->
%.

start() ->
PID = spawn(assign, answer, []),
spawn(assign, calling, [3,1234567891, PID]).