How to resolve the algorithm Table creation/Postal addresses step by step in the ooRexx programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Table creation/Postal addresses step by step in the ooRexx programming language

Table of Contents

Problem Statement

Create a table to store addresses. You may assume that all the addresses to be stored will be located in the USA.   As such, you will need (in addition to a field holding a unique identifier) a field holding the street address, a field holding the city, a field holding the state code, and a field holding the zipcode.   Choose appropriate types for each field. For non-database languages, show how you would open a connection to a database (your choice of which) and create an address table in it. You should follow the existing models here for how you would structure the table.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Table creation/Postal addresses step by step in the ooRexx programming language

Source code in the oorexx programming language

/* REXX ***************************************************************
* 17.05.2013 Walter Pachl  translated from REXX version 2
* nice try? improvements are welcome as I am rather unexperienced
* 18.05.2013 the array may contain a variety of objects!
**********************************************************************/
alist=.array~new
alist[1]=.addr~new('Boston','MA','51 Franklin Street',,'FSF Inc.',,
                                                          '02110-1301')
alist[2]='not an address at all'
alist[3]=.addr~new('Washington','DC','The Oval Office',,
                 '1600 Pennsylvania Avenue NW','The White House',20500)
Do i=1 To alist~items
  a=alist[i]
  If a~isinstanceof(.addr) Then
    a~show
  End 
   
::class addr
  ::attribute city
  ::attribute state
  ::attribute addr
  ::attribute addr2
  ::attribute name
  ::attribute zip

::method init
  Parse Arg self~city,,
            self~state,,
            self~addr,,
            self~addr2,,
            self~name,,
            self~zip

::method show
                         Say '  name -->' self~name
                         Say '  addr -->' self~addr
  If self~addr2<>'' Then Say ' addr2 -->' self~addr2
                         Say '  city -->' self~city
                         Say ' state -->' self~state
                         Say '   zip -->' self~zip
  Say copies('-',40)

  

You may also check:How to resolve the algorithm Mandelbrot set step by step in the REXX programming language
You may also check:How to resolve the algorithm Integer overflow step by step in the zkl programming language
You may also check:How to resolve the algorithm N-queens problem step by step in the Quackery programming language
You may also check:How to resolve the algorithm Flipping bits game step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Extreme floating point values step by step in the REXX programming language