Wednesday, 9 March 2016 0 comments

Examples for ATG Rest Webservices

1. Sample program for ATG Rest web services for form actor: (Rest web service example is for change password )

       <actor-chain id="changePassword" transaction="TX_SUPPORTS">
  <form id="profileFormHandler-changePassword" name="/atg/userprofiling/ProfileFormHandler" handle="changePassword" >
   <input name="value.email" value="${param.email}" />
   <input name="value.oldpassword" value="${param.oldpassword}" />
   <input name="value.password" value="${param.password}" />
   <input name="value.confirmPassword" value="${param.confirmPassword}" />
  </form>
 </actor-chain>

 <actor-chain id="changePassword-success">
  <output id="successMessage" value="Password has been successfully changed" name="Success"></output>
 </actor-chain>

 <actor-chain id="changePassword-error">
  <output id="errorMessage" value="Error" name="Error"></output>
 </actor-chain>

2. Sample program for ATG Rest web services for Droplet actor:


<actor-chain id="getAvailableShippingMethods" transaction="TX_SUPPORTS">
 <droplet id="availableShippingMethodsDroplet" name="/atg/commerce/pricing/AvailableShippingMethods" var="availableShippingMethodsDropletParamStack">
  <input name="shippingGroup" value="${nucleus['/atg/commerce/order/ShoppingCartModifier'].shippingGroup}" />
  <oparam name="output">
   <output id="availableShippingMethods" name="availableShippingMethods" value="${availableShippingMethodsDropletParamStack.availableShippingMethods}" />
  </oparam>
 </droplet>
</actor-chain>



3. Sample program for ATG Rest web services for component actor:
<actor-chain id="getDefaultShippingAddress">
 <component id="shippingAddress" name="/atg/userprofiling/Profile" component-var="profile">
  <output id="firstName" name="firstName" value="${profile.shippingAddress.firstName}" />
  <output id="lastName" name="lastName" value="${profile.shippingAddress.lastName}" />
  <output id="middleName" name="middleName" value="${profile.shippingAddress.middleName}" />
  <output id="city" name="city" value="${profile.shippingAddress.city}" />
  <output id="country" name="country" value="${profile.shippingAddress.country}" />
  <output id="area" name="area" value="${profile.shippingAddress.area}" />
 </component>
</actor-chain>


4. Sample program for ATG Rest web services for Bean filtering:

<repository name="/atg/commerce/order/OrderRepository">
    <item-descriptor default-filter="summary" name="order">
      <filter id="summary">
        <property name="commerceItems"/>
        <property name="priceInfo"/>
        <property name="totalCommerceItemCount"/>
  <property name="specialinstructions"/>
      </filter>
      <filter id="detailed">
        <property name="commerceItems"/>
        <property name="creationTime"/>
        <property name="id"/>
        <property name="lastModifiedTime"/>
        <property name="paymentGroupCount"/>
        <property name="paymentGroups"/>
        <property name="priceInfo"/>
        <property name="profileId"/>
        <property name="relationships"/>
        <property name="shippingGroupCount"/>
        <property name="shippingGroups"/>
        <property name="siteId"/>
        <property name="taxPriceInfo"/>
        <property name="totalCommerceItemCount"/>
  <property name="specialinstructions"/>
      </filter>
    </item-descriptor>
</repository>


0 comments

ATG Rest WebServices Introduction

The ATG REST Web Services provide access to Nucleus components. The Oracle ATG Web Commerce platform REST Web Services expose methods that get component data and get and set component property values. You cannot use the Oracle ATG Web Commerce platform REST Web Services to delete components.



REST Web Services exposes data and function resources through the use of Uniform Resource Identifiers (URIs). These resources are used within simple, well-defined operations. HTTP methods are used by the REST services to point to a resource. Each HTTP request returns an HTTP response, which indicates the status of the operation. The application that receives the request identifies the format of the response, which is JSON or XML. REST clients may be accessed from any browser, and security can be configured for each call.

ATG REST WEB SERVICES

The application path for REST URLs, which is the portion of the URL that follows the hostname and port number, starts with /rest/.  The REST MVC framework uses /model.The Legacy REST framework uses /bean, /repository or /service, depending on the component used.

For example:
http://servername:port/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder




HTTP requests and responses are the way that the ATG REST Web Services communicate. The following HTTP methods are used and supported by ATG REST Web Services:

Method
Explanation
GET
Use this method to return data.
Examples of the values you may get are repository item and Nucleus component property values, RQL query results, repository items, and Nucleus components.
POST
Use this method to invoke functionality or make changes to your Oracle ATG Web Commerce platform server.
For example, you may invoke methods, update Nucleus component properties, and create repository items.
PUT
(Legacy REST Only) Use this method to make changes to your Oracle ATG Web Commerce platform server.
For example, you may update repository item and Nucleus component property values.
DELETE
(Legacy REST Only) Use this method to remove repository items.

Returning Data

ATG REST Web Services returns the results of operations that you perform in an HTTP response message body. The output data can be returned in either JavaScript Object Notation (JSON) or eXtensible Markup Language (XML) format.

Enabling REST Services:

After adding the REST module to current module list in CIM follow the steps given in
integration-of-atg-with-rest-webservices


 When using REST services, you want to prevent the processing of malicious site requests. Oracle ATG Web Commerce platform uses a request parameter _dynSessConf, which contains a session confirmation number, to verify that a request is legitimate. For further information on session confirmation numbers, and the warnings that occur if the request is not legitimate

ATG REST ARCHITECTURE

Actor Types

The REST MVC API’s modular and extensible functionality is based on actors, which uses a number of different types of actors to perform a variety of functions. The atg.service.actor.Actor interface contains the following actor types that perform specific actions or provide configurations.

  • Component Actor – You use this actor to set component property values or invoke methods on a component, or to read component property values
  • Droplet Actor – Use this actor when you want to invoke droplets and output data from the droplet to the ModelMap. Inputs are mapped to the droplet input parameter. Other types of actors can be nested in the oparam parameter of a DropletActor
  • Form Actor – Use this actor to set up form handler inputs and submit a form
  • JSP Actor – This actor invokes a JSP page and adds the JSP response or JSP-defined variables to the ModelMap
  • Nested Actor – These actors allow you to invoke actor-chains from within other actor-chains, helping to define modular units of work that can be combined and extended.
  • Variable Actor – The VarActor enables you to set variables in the actor context


REST XML SCHEMA DIAGRAM

Bean Filtering


The BeanFilterService filters the properties of a java bean or repository item and converts beans into a map of properties. The BeanFilterService reads XML definition files that define which properties of a Java class or repository item should be included in the filtered view of the object. The XML definitions include ways to remap property names and transform properties.
By default, the BeanFilterService is applied to the ModelMap by the REST MVC framework before generating a JSON or XML response. However, you can filter objects at any time. For example, you can use the BeanFilterService as a ComponentActor to filter a repository item before adding it to the ModelMap.


ATG Rest WebServices Examples are Explained Here.

REFERENCES:

 Notes / theory is copied majorly from Orcacle DOCS

Monday, 7 March 2016 0 comments

Sample Program for ATG Wishlist, Giftlist

Sample program to display wishlist items

<dsp:page>
	<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
	<dsp:importbean bean="/atg/userprofiling/Profile"/>
	<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
	<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
	<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>

	<b> <center>My Favourites Listing</center></b>
	<br>
	<dsp:valueof param="Profile"/>
	<dsp:setvalue beanvalue="Profile.wishlist" param="wishlist"/>
	<dsp:setvalue paramvalue="wishlist.giftlistItems" param="items"/>
	<dsp:setvalue paramvalue="wishlist.id" param="wishlistId"/>
	<table cellspacing=2 cellpadding=1 border=1 width=75%>
    
		      <tr>
		      	<td colspan=8>My Favourites</td>
		      </tr>
		      <tr>
		        <dsp:droplet name="IsEmpty">
					  <dsp:param name="value" param="items"/>
					  <dsp:oparam name="false">
					    		<dsp:droplet name="/atg/dynamo/droplet/ForEach">
					      				<dsp:param name="array" param="items"/>
					      				<dsp:oparam name="output">
					        			<tr valign=top>
					        			<td>
											<dsp:valueof param="element"/>
											Quantity:  <dsp:valueof param="element.quantityDesired"/>
										</td>
					        			<td></td>
       									<td>
										<dsp:droplet name="/atg/commerce/catalog/ProductLookup">
								            <dsp:param name="id" param="element.productId"/>
								            <dsp:param name="elementName" value="product"/>
								            <dsp:oparam name="output">
								              <b>
								              <dsp:droplet name="/atg/commerce/catalog/SKULookup">
										              <dsp:param name="id" param="element.catalogRefId"/>
										              <dsp:param name="elementName" value="giftSku"/>
										              <dsp:oparam name="output">
										              	  item Name: <dsp:valueof param="giftSku.displayName"/>
										              	  <br>
													   </dsp:oparam>
								                </dsp:droplet>
								                </b>
								            </dsp:oparam>
								          </dsp:droplet>
								        </td>
								        <td></td>
							</dsp:oparam>
						</dsp:droplet>
					</dsp:oparam>
				</dsp:droplet>
			</tr>
		</table>
</dsp:page>	  



Sample program to display giftlists


<dsp:page>
	<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
	<dsp:importbean bean="/atg/userprofiling/Profile"/>
	<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
	<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
	<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>
	<dsp:importbean bean="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet"/>
	<b> <center>Display List of Registry present in user profile.</center></b>
	<br>
	<dsp:droplet name="GiftlistSiteFilterDroplet">
        <dsp:param name="collection"  bean="/atg/userprofiling/Profile.giftlists"/>
        <dsp:oparam name="output">
          <dsp:getvalueof var="giftlists" param="filteredCollection" />
  				<c:forEach var="giftlist" items="${giftlists}" varStatus="giftlistStatus">
		              <dsp:getvalueof var="count" idtype="int" value="${giftlistStatus.count}"/>
		              <dsp:getvalueof var="index" idtype="int" value="${giftlistStatus.index}"/>
		              <dsp:param name="giftlist" value="${giftlist}"/>
  					  <dsp:getvalueof var="eventName" vartype="java.lang.String" param="giftlist.eventName"/>
                		<br>
                		eventName: <c:out value="${eventName}"/>
                		<br>
                		<br/>
                		Owner : <dsp:valueof value="${giftlist.owner.id}"/></br/>
						<dsp:getvalueof var="eventType" param="giftlist.eventType"/>
      				  <br>
                		eventType: <c:out value="${eventType}"/>
						Event Description:
                		<dsp:getvalueof var="description" param="giftlist.description"/>
      				 	<c:out value="${description}"/>
      				 	<br>
      				 	special instructions And Venue Details:
      				 	<dsp:getvalueof var="instructions" param="giftlist.instructions"/>
      				 	<c:out value="${instructions}"/>
      				 	<br>
      				 	Comments:
      				 	<dsp:getvalueof var="comments" param="giftlist.comments"/>
      				 	<c:out value="${comments}"/>
      				 	<br>
      				 	Shipping Address Associated:<br>
      				 	<dsp:valueof param="giftlist.owner.firstName"/>
      				 	<dsp:valueof param="giftlist.owner.lastName"/>
      				 	<dsp:valueof param="giftlist.shippingAddress.firstName"/>
					    <dsp:valueof param="giftlist.shippingAddress.middleName"/>
					    <dsp:valueof param="giftlist.shippingAddress.lastName"/><br>
					    <dsp:valueof param="giftlist.shippingAddress.city"/>,
					    <dsp:valueof param="giftlist.shippingAddress.state"/><br>
      				 	<br>
						 List of items in the Registry are:
	                  <dsp:droplet name="/atg/dynamo/droplet/ForEach">
						     <dsp:param name="array" param="giftlist.giftlistItems"/>
						     <dsp:oparam name="output">
						      <dsp:setvalue paramvalue="element" param="item"/>
						      <dsp:getvalueof param="item.id" var="itemId"/>
						      gitemId:<c:out value="${itemId}"/>
							  <<<Using product look up droplet print the element details as shown in wishlist example>>>
							  </dsp:oparam>
					    </dsp:droplet>
					    <br>
					    
					    <br>
				</c:forEach>
				<dsp:oparam name="empty">
					There are no gift lists to display.
				</dsp:oparam>
      </dsp:droplet>
</dsp:page>


Sample program to remove item from giftlist/wishlist:
<dsp:page>
<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
<dsp:form id="f1" method="POST" action="">
	<dsp:getvalueof var="giftlistId" param="giftListId"></dsp:getvalueof>
	<dsp:getvalueof var="giftId" param="giftId"></dsp:getvalueof>

	  <dsp:droplet name="/atg/commerce/gifts/RemoveItemFromGiftlist">
		<dsp:param name="giftlistId" param="giftListId"/>
		<dsp:param name="giftId" value="${giftId}"/>
		<dsp:oparam name="error">
		  <font color=cc0000><STRONG><UL>
		  <li>Either giftlist not found or you are not the owner.
		  </UL></STRONG></font>
		</dsp:oparam>
		<dsp:oparam name="output">
		<font color=cc0000><STRONG><UL>
		  <li>Gift List Item Successfully removed.
		  </UL></STRONG></font>
		  <dsp:include page="myFavouritesHome.jsp" />
		  
		</dsp:oparam>
	  </dsp:droplet>

	<dsp:input bean="GiftlistFormHandler.giftlistId" paramvalue="giftlistId" type="hidden"/>
</dsp:form>
</dsp:page>



Sample program to add item to wishlist/ giftlist:


<dsp:form action="addItemtoMyFav.jsp" method="post" id="glform">
	<input name="id" type="hidden" value='<dsp:valueof param="id"/>'/>
	<input type="hidden" name="itemType" value="product"/>
	<input name="itemId" type="hidden" value="prod10001"/>
	<dsp:input bean="GiftlistFormHandler.productId" value="prod10001" type="hidden"/>
	quantity <dsp:input bean="GiftlistFormHandler.quantity" size="4" type="text" value="1"/>
	<dsp:input bean="GiftlistFormHandler.catalogRefIds" value="sku10001" type="hidden"/>
	<dsp:setvalue beanvalue="Profile.wishlist" param="wishlist"/>
	<dsp:setvalue paramvalue="wishlist.id" param="wishlistId"/>
	<dsp:valueof param="wishlistId"/>
	<c:set var="wishlistId"><dsp:valueof param="wishlistId"/></c:set>
	<dsp:input type="hidden" bean="GiftlistFormHandler.giftlistId" value="${wishlistId}"></dsp:input>
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlistErrorURL" type="hidden" value="addItemtoMyFav.jsp"/>
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlistSuccessURL" type="hidden" value="myFavouritesHome.jsp"/>							
	<dsp:input bean="GiftlistFormHandler.addItemToGiftlist" type="submit" value="Add to Fav"/>	
</dsp:form>	



Sample program to create Giftlist:

<dsp:page>
<dsp:importbean bean="/atg/commerce/gifts/GiftlistFormHandler"/>
<dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
<dsp:importbean bean="/atg/dynamo/droplet/Switch"/>
<dsp:importbean bean="/atg/dynamo/droplet/IsEmpty"/>
<dsp:importbean bean="/atg/userprofiling/Profile"/>
<%--
	Deal with error messages here by including error page here
 --%>
 <dsp:include page="giftListErrors.jsp" />

<span class=storebig>Create new Registry</span>
<dsp:form action="giftListHome.jsp" method="POST">
<b>Event Name</b><br>
<dsp:setvalue bean="GiftlistFormHandler.eventName" value=""/>
  <dsp:input bean="GiftlistFormHandler.eventName" size="40" type="text"/>
  <p>
  <b>Event Date</b>
  <dsp:select bean="GiftlistFormHandler.month">
    <dsp:droplet name="ForEach">
      <dsp:param bean="GiftlistFormHandler.months" name="array"/>
      <dsp:oparam name="output">
        <dsp:getvalueof id="option564" param="index"
             idtype="java.lang.Integer">
          <dsp:option value="<%=option564%>"><dsp:valueof param="element">UNDEFINED</dsp:valueof></dsp:option>
      </dsp:getvalueof>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:select>
  <dsp:select bean="GiftlistFormHandler.date">
  <dsp:droplet name="ForEach">
    <dsp:param bean="GiftlistFormHandler.dates" name="array"/>
    <dsp:oparam name="output">
      <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
    </dsp:oparam>
  </dsp:droplet>
  </dsp:select>
  <dsp:select bean="GiftlistFormHandler.year">
  <dsp:droplet name="ForEach">
    <dsp:param bean="GiftlistFormHandler.years" name="array"/>
    <dsp:oparam name="output">
      <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
    </dsp:oparam>
    </dsp:droplet>
    </dsp:select>
   <p>
   <b>Event Type</b>
   <dsp:select bean="GiftlistFormHandler.eventType">
   <dsp:droplet name="ForEach">
     <dsp:param bean="GiftlistFormHandler.eventTypes" name="array"/>
     <dsp:oparam name="output">
       <dsp:option paramvalue="element">
       <dsp:valueof param="element">UNDEFINED</dsp:valueof>
       </dsp:option>
     </dsp:oparam>
     </dsp:droplet>
     </dsp:select><br>
<br>
  <b>Event Description</b><br>
  <dsp:setvalue bean="GiftlistFormHandler.description" value=""/>
<%--  <dsp:textarea bean="GiftlistFormHandler.description" maxlength="254"
                    value="" rows="4" cols="40"></dsp:textarea> --%>
  <dsp:textarea bean="GiftlistFormHandler.description" rows="4"
       cols="40"></dsp:textarea>
  <p>
  <b>special instructions And Venue Details</b><br>
  <%-- <dsp:textarea bean="GiftlistFormHandler.instructions"
        maxlength="254" value="" rows="4" cols="40"></dsp:textarea> --%>
        <dsp:setvalue bean="GiftlistFormHandler.instructions" value=""/>
  <dsp:textarea bean="GiftlistFormHandler.instructions" rows="4"
       cols="40"></dsp:textarea>
  <p>
  <br>
    <b>Comments</b><br>
  <dsp:setvalue bean="GiftlistFormHandler.comments" value=""/>
  <dsp:textarea bean="GiftlistFormHandler.comments" rows="4"
       cols="40"></dsp:textarea>
<%--  <dsp:textarea bean="GiftlistFormHandler.comments" maxlength="254"
       value="" rows="4" cols="40"></dsp:textarea></dsp:textarea> --%>
  <p>
  <b>Where should people ship the gifts?</b><p>
  <blockquote>
  <dsp:input bean="GiftlistFormHandler.isNewAddress" type="radio"
       checked="<%=true%>" value="false"/>Choose one of your saved
       shipping destinations.<br>
    <dsp:select bean="GiftlistFormHandler.shippingAddressId">
    <dsp:droplet name="ForEach">
      <dsp:param bean="GiftlistFormHandler.addresses" name="array"/>
      <dsp:oparam name="output">
        <dsp:getvalueof id="option695" param="key"
             idtype="java.lang.String">
          <dsp:option value="<%=option695%>"><dsp:valueof param="element">UNDEFINED</dsp:valueof></dsp:option>
        </dsp:getvalueof>
      </dsp:oparam>
    </dsp:droplet>
    </dsp:select><br>
  <p>
  <dsp:input bean="GiftlistFormHandler.isNewAddress" type="radio"
       value="true"/>New address below
  <p>
  If you want this address stored in your address book, please give it a
  nickname:<br>
  <dsp:input bean="GiftlistFormHandler.newAddressName" size="40"/><br>
  Name <br><dsp:input bean="GiftlistFormHandler.newAddress.firstName"
            name="firstName" size="15"/>
  <dsp:input bean="GiftlistFormHandler.newAddress.middleName"
       name="middleName" size="5"/>
  <dsp:input bean="GiftlistFormHandler.newAddress.lastName"
       name="lastName" size="15"/><br>
  Street address <br>
  <dsp:input bean="GiftlistFormHandler.newAddress.address1"
       name="address1" size="40"/><br>
  <dsp:input bean="GiftlistFormHandler.newAddress.address2"
       name="address2" size="40"/><br>
  <table border=0 cellspacing=0 cellpadding=0>
    <tr valign=top>
      <td>City<br>
      <dsp:input bean="GiftlistFormHandler.newAddress.city" name="city"
           size="15"/></td>
      <td>State<br>
     <dsp:input  bean="GiftlistFormHandler.newAddress.state" name="state" size="15"/>
      </td>
     <td>Postal Code<br>
     <dsp:input bean="GiftlistFormHandler.newAddress.postalCode"
          name="postalCode" size="15"/></td>
    </tr>
  </table>

     Country
            <dsp:input bean="GiftlistFormHandler.newAddress.country" name="country" size="15"/>
           
  </blockquote>

  <p>&nbsp;<br>
  </td>
  </tr>

  <tr valign=top>
  <td width=30%>
  <span class=help>
  Decide if you want your list to be public yet. When you make your list
  public, your friends can
  find your list by searching.
  </span>

  </td>
  <td></td>
  <td>
  <table width=100% cellpadding=0 cellspacing=0 border=0>
  <tr><td class=box-top-store>Gift list public?</td></tr></table>
  <p>

  <dsp:input bean="GiftlistFormHandler.isPublished" name="published"
       type="radio" value="true"/> Make my list public now<br>
  <dsp:input bean="GiftlistFormHandler.isPublished" name="published"
       type="radio" checked="<%=true%>" value="false"/> Don't make my list
       public yet

  <p>&nbsp;<br>
<dsp:input bean="GiftlistFormHandler.type" value="GIFTLIST" type="hidden"/>  
<dsp:input bean="GiftlistFormHandler.saveGiftlist" value="Create and Save giftlist" type="submit"/>
       </p>
       </td>
       </tr>
       </p>
       </dsp:form>
       </dsp:page>
       




Sunday, 6 March 2016 0 comments

WishList and GiftLists in ATG



Both WishList and GiftList in ATG is implemented using gift list repository in ATG.

Primary differences between wish list and gift list are explained below:

Wish list for a user is nothing but list of his favorite items. User can store his favorite items for his future purchases.
Gift list for a user is explained in the below example:
Say user is having his wedding on some date, and he is interested in getting some particular things as gifts, then he will populate giftlist and share it with different other users in our application. 

WISHLIST
GIFTLIST
User is associated with only one wishlist.
There can be ‘N ’ number of lists associated with user
Wishlist is Private to the User. And only user can purchase items from his wish list
Giftlist can be made public or private based on the interest of the user. Only public list can be shared to other users. Other users can purchase items for the owner of that list.
Wishlist will not have any shipping address associated with it.
Giftlist will have a shipping address associated with it.
By default a wishlist is created for ATG user
User has to create his giftLists

Public Giftlists of others can be viewed using ‘OtherGiftlists’

Giftlist Repository:

The Giftlists repository is the layer between Oracle ATG Web Commerce and the database itself. It provides an interface to the database layer to persist gift list information. The Giftlists repository uses the SQL Repository implementation. The Giftlists repository is defined in the giftlists.xml definition file, located in the Commerce configuration path at /atg/commerce/gifts/. This XML file defines item descriptors for gift lists and gift list items.

Gift List Form Handlers:

The /atg/commerce/gifts/GiftlistFormHandler accepts input from the customer to create, update and delete gift lists, as well as to add items to and remove items from gift lists. Properties in the handler are used to store user input for processing, as well as to store success and failure URLs for redirect after processing. Some handle methods have pre- and post- methods defined to make it easier to extend the methods.

The /atg/commerce/gifts/GiftlistSearch form handler searches the repository for gift lists. The form handler uses input from the customer, such as owner name, event name, event type and state, to find gift lists published by other customers.

CLICK HERE FOR BELOW SAMPLE PROGRAMS:

 
;