Question: CODE IN ERLANG 1. Function money that that takes two tuples, where each tuple represents a money object (each tuple consists of 2 values: dollars

CODE IN ERLANG

CODE IN ERLANG 1. Function money that that takes two tuples, where

1. Function money that that takes two tuples, where each tuple represents a money object (each tuple consists of 2 values: dollars and cents) and calculates and returns a new tuple that constitutes the addition of the incoming money objects (dollars + dollars, cents + cents). Assume valid positive integers will be passed and do NOT error check. Normalize the values, i.e. if the cents addition results in a value > 99, adjust dollars and cents properly (hint: to pattern match a function on a tuple consisting of 2 elements, you can use functionName({X, Y}) -> ... type of a syntax) 1. Function money that that takes two tuples, where each tuple represents a money object (each tuple consists of 2 values: dollars and cents) and calculates and returns a new tuple that constitutes the addition of the incoming money objects (dollars + dollars, cents + cents). Assume valid positive integers will be passed and do NOT error check. Normalize the values, i.e. if the cents addition results in a value > 99, adjust dollars and cents properly (hint: to pattern match a function on a tuple consisting of 2 elements, you can use functionName({X, Y}) -> ... type of a syntax)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!