Hi, <br><br>May you kindly help with the exercise below using Erlang [I am new Erlang Development]:<br><br>












<style>
<!--
 /* Font Definitions */
@font-face
        {font-family:Arial;
        panose-1:2 11 6 4 2 2 2 2 2 4;
        mso-font-charset:0;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:3 0 0 0 1 0;}
@font-face
        {font-family:Times;
        panose-1:2 0 5 0 0 0 0 0 0 0;
        mso-font-charset:0;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:3 0 0 0 1 0;}
@font-face
        {font-family:"MS 明朝";
        panose-1:0 0 0 0 0 0 0 0 0 0;
        mso-font-charset:128;
        mso-generic-font-family:roman;
        mso-font-format:other;
        mso-font-pitch:fixed;
        mso-font-signature:1 134676480 16 0 131072 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:1;
        mso-generic-font-family:roman;
        mso-font-format:other;
        mso-font-pitch:variable;
        mso-font-signature:0 0 0 0 0 0;}
@font-face
        {font-family:Cambria;
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:3 0 0 0 1 0;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:Cambria;
        mso-ascii-font-family:Cambria;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:"MS 明朝";
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Cambria;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-family:Cambria;
        mso-ascii-font-family:Cambria;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:"MS 明朝";
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Cambria;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        mso-header-margin:36.0pt;
        mso-footer-margin:36.0pt;
        mso-paper-source:0;}
div.WordSection1
        {page:WordSection1;}
 /* List Definitions */
@list l0
        {mso-list-id:1;
        mso-list-type:hybrid;
        mso-list-template-ids:1 1 -1 -1 -1 -1 -1 -1 -1 -1;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:•;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level3
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level4
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level5
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level6
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level7
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level8
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l0:level9
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1
        {mso-list-id:2;
        mso-list-type:hybrid;
        mso-list-template-ids:2 101 -1 -1 -1 -1 -1 -1 -1 -1;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:•;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level3
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level4
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level5
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level6
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level7
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level8
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l1:level9
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2
        {mso-list-id:3;
        mso-list-type:hybrid;
        mso-list-template-ids:3 201 -1 -1 -1 -1 -1 -1 -1 -1;}
@list l2:level1
        {mso-level-number-format:bullet;
        mso-level-text:•;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l2:level2
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level3
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level4
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level5
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level6
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level7
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level8
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l2:level9
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3
        {mso-list-id:4;
        mso-list-type:hybrid;
        mso-list-template-ids:4 301 -1 -1 -1 -1 -1 -1 -1 -1;}
@list l3:level1
        {mso-level-number-format:bullet;
        mso-level-text:•;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l3:level2
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level3
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level4
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level5
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level6
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level7
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level8
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
@list l3:level9
        {mso-level-start-at:0;
        mso-level-text:"";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:0cm;
        text-indent:0cm;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>






<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">Introduction</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">Meet Mr. and Mrs. Hollingberry. Recently retired, Mr. Hollingberry has
decided to move to sunny South Africa and open up a small local convenience
store to keep him and Mrs. Hollingberry out of mischief.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">Alas, it turned out not be such a laid-back job as he had hoped...</span></p>

<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">The Problem</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">One of their current problems is printing price tags on their fresh
produce. Every morning, as soon as the various produce have been delivered,
Mrs. Hollingberry enters it into a program her nephew had written.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The result is a comma-seperated file that includes, among other fields,
the cost price (in cents) and delivery date of each product.</span></p>

<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">The Task</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">Your job is to write a program that reads the csv file and then creates
a new file that will be used to print out the price tags.</span></p>

<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">The Input File</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">An example csv file is in this directory (produce.csv). We use the
following fields:</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Supplier ID.
All suppliers are equal, but some are more equal than
others.</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Product code.
This tells us what kind of produce we're dealing with.</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Description.
We can print part of this on the price tag.</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Delivery date.
YYYY-MM-DD. We use this to calculate the sell-by date.</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Cost price.
In cents. We use this to calculate the selling price.</span></p>

<p class="MsoNormal" style="margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Unit count.
We need to print a price tag for each item delivered.</span></p>

<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">The Output File</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The price file has 3 fields on each line: the selling price, the sell-by
date and a product description.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The price file is in fixed-width format, because the label printer has
limited space (50 characters) for each price tag. Each line in the price file
will cause one price tag to be printed.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The selling price takes up 9 characters. One currency symbol (R) and 8
digits where Rands and cents are seperated by a period: R99999.99</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">Mr Hollingberry says we shouldn't worry about larger amounts. If he ever
sells something for a 100 grand he will have to retire again, and he can't take
that kind of stress again.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The sell-by date, just like the delivery date in the input file, is in
YYYY/MM/DD format (10 characters).</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">The remaining 31 characters is used for the product description.</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">A typical line in the price file will look like this:</span></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">R 19.922012/05/26Apples 1kg Green. They are very</span></p>

<p class="MsoNormal" style="margin-bottom:16.0pt;text-autospace:none"><b><span style="font-size:24.0pt;font-family:Times">The Business Rules</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">You have to calculate the selling price and the sell-by date. Luckily we
can use the description just as it is in the csv file. Well, the first 31
characters of it anyway.</span></p>

<p class="MsoNormal" style="margin-bottom:14.0pt;text-autospace:none"><b><span style="font-size:18.0pt;font-family:Times">Markup Rules</span></b></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">The markup for apples is 40%.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">The markup for bananas is 35%.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">The markup for berries is 55%.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">The markup for anything else 50%.</span></p>

<p class="MsoNormal" style="margin-bottom:14.0pt;text-autospace:none"><b><span style="font-size:14.0pt;font-family:Times">Premium Produce (tm)</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">Some suppliers are dedicated Premium Produce (tm) suppliers. The
customer has to believe that they are buying something better than usual. We do
this by making the packaging look nice, and by increasing the price. The
suppliers already took care of the nice packaging, you now have to make it
expensive. Anything supplied by a Premium Produce (tm) supplier gets an
additional 10% markup, and then the price is rounded up to the nearest Rand.
For example, if a product costs R25.11 after the extra 10% markup has been
applied, you need to round it up to R26. The Premium Produce suppliers
currently are: * Promise Mashangu (Supplier ID 219) * Karel Visser (Supplier ID
204)</span></p>

<p class="MsoNormal" style="margin-bottom:14.0pt;text-autospace:none"><b><span style="font-size:18.0pt;font-family:Times">Sell-by Dates</span></b></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Apples have to be sold 2 weeks after the date of delivery.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Bananas have to be sold 5 days after the date of delivery.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">All other types of fruit has to be sold 1 week after the date of
delivery.</span></p>

<p class="MsoNormal" style="margin-bottom:14.0pt;text-autospace:none"><b><span style="font-size:14.0pt;font-family:Times">Supplier Troubles</span></b></p>

<p class="MsoNormal" style="margin-bottom:12.0pt;text-autospace:none"><span style="font-family:Times">One the suppliers, Susan Windler (Supplier ID 32), has been known to
deliver fruit that is not quite as fresh as that of the other suppliers. Mr.
Hollingberry has decided to handle this quietly, by ensuring that the sell-by
date for anything delivered by Susan is always 3 days earlier than normal. Come
to think of it, Togetherness Tshabalala (Supplier ID 101), also needs to be on
this list.</span></p>

<p class="MsoNormal" style="margin-bottom:14.0pt;text-autospace:none"><b><span style="font-size:14.0pt;font-family:Times">Product Codes</span></b></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Fruit has product codes ranging from 1000 to 1999.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Apples specifically have product codes ranging from 1100 to 1199.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Bananas have product codes ranging from 1200 to 1299.</span></p>

<p class="MsoNormal" style="margin-left:36.0pt;text-autospace:none"><span style="font-family:Times"><span style>•<span style="font:7.0pt "Times New Roman"">   
</span></span></span><span style="font-family:Times">Berries have product codes ranging from 1300 to 1399.</span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:Arial;color:#104abc"> </span></p>

<p class="MsoNormal"> </p>





Kindest Regards<br>Lucky KHoza <br><br><br>