shop.erl
%% Author: Administrator
%% Created: 2012-8-23
%% Description: TODO: Add description to shop
-module(shop).
%%
%% Include files
%%
%%
%% Exported Functions
%%
-export([cost/1]).
%%
%% API Functions
%%
cost(oranges)
->5;
cost(newspaper)
->8;
cost(apples)
->2;
cost(pears)
->9;
cost(milk)
->7.
%%
%% Local Functions
%%
shop1.erl
%% Author: Administrator
%% Created: 2012-8-23
%% Description: TODO: Add description to shop1
-module(shop1).
%%
%% Include files
%%
%%
%% Exported Functions
%%
-export([total/1]).
%%
%% API Functions
%%
total([{What,N}|T])
->shop:cost(What)*N+total(T);
total([])
->0.
%%
%% Local Functions
%%