Current Status

Book

Program Phases, A Programming Language and API Translator allows programmers to learn new programming languages by providing simple indexed example programs. Each program illustrates useful, common, and well defined functionality.

  • The following example program implementations of Program Phase Task 1 (Hello World! with Strings) illustrate the Program Phases methodology:
  Program Phase 1-1 - Java
  Program Phase 1-2 - Visual FoxPro
Program Phase 1-3 - C
  Program Phase 1-4 - Visual Basic 6
  Program Phase 1-5 - C++ with MFC
  Program Phase 1-6 - C# with .NET Framework
  Program Phase 1-7 - Visual Basic .NET
  Program Phase 1-8 - Managed C++
  Program Phase 1-9 - Python
  Program Phase 1-10 - Perl
 
  • pp1_1.java: Program Phase 1-1 Java Source Code


//***************************************************************************************************************
// Program Phase 1-1 Java Hello World! with Strings
// Programming Tasks Illustrated: Console Application
//                                Integer and String Variable Declarations
//                                Application Command Line Parameters
//                                Case/Switch Statement
//                                String Literal Assignment and Concatenation
//                                Console Application Standard Output
//***************************************************************************************************************

//***************************************************************************************************************
// File: pp1_1.java
// Reserved
//***************************************************************************************************************

package programphases.programphase1_1;

public class pp1_1
{ 


//***************************************************************************************************************
// Program Phase 1-1 Main
// Define the Entry Point of Execution (EPE) for Program Phase 1-1
// CBI:  1-1.1.1.1
//***************************************************************************************************************
    
public static void main(final String argv[])
{


//***************************************************************************************************************
// Program Phase 1-1 Main
// Declare the local variables for the "main" program
// CBI:  1-1.1.1.2
//***************************************************************************************************************
 
   int lnCmdLineParamCount; 
   String lcString1;
   String lcString2;
   String lcStringOutput1;
   String lcStringOutput2;


//***************************************************************************************************************
// Program Phase 1-1 Main
// Store the command line parameters
// CBI:  1-1.1.1.3
//***************************************************************************************************************

   // The local argv array stores the command line parameters.
   lnCmdLineParamCount = argv.length; 


//***************************************************************************************************************
// Program Phase 1-1 Main
// Parse the command line parameters using a Case/Switch statement
// CBI:  1-1.1.1.4
//***************************************************************************************************************
 
   switch (lnCmdLineParamCount)
   {
      case 0:
         lcStringOutput1 = "You entered no command line parameters.";
         break; 

          
      case 1:
         lcStringOutput1 = "Command line parameter entered: " + argv[0];
         break;
       
      default:
         lcStringOutput1 = "The command line is limited to 1 parameter.";
   }


//***************************************************************************************************************
// Program Phase 1-1 Main
// Concatenate two string variables
// CBI:  1-1.1.1.5
//***************************************************************************************************************

   lcString1 = "Hello";
   lcString2 = "World!";
   lcStringOutput2 = lcString1 + " " + lcString2; 


//***************************************************************************************************************
// Program Phase 1-1 Main
// Output to standard output
// CBI:  1-1.1.1.6
//***************************************************************************************************************

   System.out.println(lcStringOutput1);
   System.out.println(lcStringOutput2); 
}} 


 
 
  • pp1_2.prg: Program Phase 1-2 Visual FoxPro Source Code


*****************************************************************************************************************
** Program Phase 1-2 Visual FoxPro Hello World
** Programming Tasks Illustrated: GUI Based Application
**                                Integer and String Variable Declarations
**                                Application Command Line Parameters
**                                Case/Switch Statement
**                                String Literal Assignment and Concatenation
**                                Message Box Output
*****************************************************************************************************************

*****************************************************************************************************************
** File: pp1_2.prg
** Reserved
*****************************************************************************************************************

LPARAMETERS argv1,argv2,argv3,argv3,argv4


*****************************************************************************************************************
** Main
** Define the Entry Point of Execution (EPE) for Program Phase 1-2
** CBI:  1-2.1.1.1
*****************************************************************************************************************

** The first line of the code in the pp1_2.prg file is the EPE.


*****************************************************************************************************************
** Main   
** Declare the local variables for the "main" program
** CBI:  1-2.1.1.2
*****************************************************************************************************************

LOCAL lnCmdLineParamCount
LOCAL lcString1
LOCAL lcString2
LOCAL lcStringOutput1
LOCAL lcStringOutput2


*****************************************************************************************************************
** Main
** Store the command line parameters
** CBI:  1-2.1.1.3
*****************************************************************************************************************

** The command line parameters are stored in the LPARAMETERS variables specified
** in the Reserved code block.

lnCmdLineParamCount = PCOUNT()


*****************************************************************************************************************
** Program Phase 1-2 Main
** Parse the command line parameters using a Case/Switch statement
** CBI:  1-2.1.1.4
*****************************************************************************************************************

DO CASE

   CASE lnCmdLineParamCount == 0
   
      lcStringOutput1 = "You entered no command line parameters."
   
   CASE lnCmdLineParamCount == 1
 
      lcStringOutput1 = "Command line parameter entered: " + argv1
      
   OTHERWISE   
  
      lcStringOutput1 = "The command line is limited to 1 parameter."
      
ENDCASE


*****************************************************************************************************************
** Program Phase 1-2 Main
** Concatenate two string variables
** CBI: 1-2.1.1.5
*****************************************************************************************************************

lcString1 = "Hello"
lcString2 = "World!"
lcStringOutput2 = lcString1 + " " + lcString2   


*****************************************************************************************************************
** Program Phase 1-2 Main
** Output to standard output
** CBI:  1-2.1.1.6
*****************************************************************************************************************

   ** Message box GUI output is used instead of console output.
   =MESSAGEBOX(lcStringOutput1 + chr(13) + lcStringOutput2)



 
 
  • pp1_3.c: Program Phase 1-3 C Source Code

//***************************************************************************************************************
// Program Phase 1-3 C Hello World! with Strings
// Programming Tasks Illustrated: Console Application
//                                Integer and String Variable Declarations
//                                Application Command Line Parameters
//                                Case/Switch Statement
//                                String Literal Assignment and Concatenation
//                                Console Application Standard Output
//***************************************************************************************************************


//***************************************************************************************************************
// File: pp1_3.c
// Reserved 
//***************************************************************************************************************

#include <stdio.h>
#include <string.h>


//***************************************************************************************************************
// Program Phase 1-3 Main
// Define the Entry Point of Execution (EPE) for Program Phase 1-3
// CBI:  1-3.1.1.1
//***************************************************************************************************************

int main(int argc, char* argv[])
{


//***************************************************************************************************************
// Program Phase 1-3 Main
// Declare the local variables for the "main" program
// CBI:  1-3.1.1.2
//***************************************************************************************************************
   
   int lnCmdLineParamCount;
   char lcString1[5 + 1];  
   char lcString2[6 + 1]; 
   char lcStringOutput1[256];  
   char lcStringOutput2[5 + 6 + 1 + 1]; 


//***************************************************************************************************************
// Program Phase 1-3 Main
// Store the command line parameters
// CBI:  1-3.1.1.3
//***************************************************************************************************************

   // The laArgv array stores the command line parameters.
   lnCmdLineParamCount = argc - 1;


//***************************************************************************************************************
// Program Phase 1-3 Main
// Parse the command line parameters using a Case/Switch statement
// CBI:  1-3.1.1.4
//***************************************************************************************************************

   switch(lnCmdLineParamCount)
   {
      case 0:  
         sprintf(lcStringOutput1,"You entered no command line parameters.");
         break;

      case 1:
         sprintf(lcStringOutput1,"Command line parameter entered: %s",argv[1]);
         break;

      default:
        sprintf(lcStringOutput1,"The command line is limted to 1 parameter.");
   }


//***************************************************************************************************************
// Program Phase 1-3 Main
// Concatenate two string variables
// CBI:  1-3.1.1.5
//***************************************************************************************************************


   strcpy(lcString1,"Hello");
   strcpy(lcString2,"World!");
   sprintf(lcStringOutput2,"%s %s",lcString1,lcString2);   


//***************************************************************************************************************
// Program Phase 1-3 Main
// Output to standard output
// CBI:  1-3.1.1.6
//***************************************************************************************************************

   fprintf(stdout,"%s \n",lcStringOutput1);
   fprintf(stdout,"%s \n",lcStringOutput2);

   return 0;
}

 
 
  • pp1_4.bas: Program Phase 1-4 Visual Basic 6 Source Code

''***************************************************************************************************************
'' Program Phase 1-4 Visual Basic 6 Hello World! with Strings
'' Programming Tasks Illustrated: GUI Based Application
''                                Integer and String Variable Declarations
''                                Application Command Line Parameters
''                                Case/Switch Statement
''                                String Literal Assignment and Concatenation
''                                Message Box Output
''***************************************************************************************************************

''***************************************************************************************************************
'' File: pp1_4.bas
'' Reserved
''***************************************************************************************************************


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Define the Entry Point of Execution (EPE) for Program Phase 1-4
'' CBI:  1-4.1.1.1
''***************************************************************************************************************

Sub Main()


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Declare the local variables for the "main" program
'' CBI:  1-4.1.1.2
''***************************************************************************************************************

   Dim argc As Integer
   Dim argv() As String
   Dim lcString1 As String
   Dim lcString2 As String
   Dim lcStringOutput1 As String
   Dim lcStringOutput2 As String


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Store the command line parameters
'' CBI:  1-4.1.1.3
''***************************************************************************************************************

   argv = Split(Command, " ")
   argc = UBound(argv) + 1


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Parse the command line parameters using a Case/Switch statement
'' CBI:  1-4.1.1.4
''***************************************************************************************************************
      
   Select Case argc
      
      Case 0
          
         lcStringOutput1 = "You entered no command line parameters."
      
      Case 1
      
         lcStringOutput1 = "Command line paramater entered: " + argv(0)
      
      Case Else
               

      lcStringOutput1 = "The command line is limited to 1 parameter."    
   
   End Select


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Concatenate two string variables
'' CBI: 1-4.1.1.5
''***************************************************************************************************************

   lcString1 = "Hello"
   lcString2 = "World!"
   lcStringOutput2 = lcString1 &amp;amp; lcString2


''***************************************************************************************************************
'' Program Phase 1-4 Main
'' Output to standard output
'' CBI:  1-4.1.1.6
''***************************************************************************************************************

   '' Message box GUI output is used instead of console output.

   MsgBox (lcStringOutput1 &amp;amp; Chr(13) &amp;amp; lcStringOutput2)

End Sub


 
 
  • pp1_5.cpp: Program Phase 1-5 C++ with MFC Source Code


//***************************************************************************************************************
// Program Phase 1-5 C++ MFC Hello World! with Strings
// Programming Tasks Illustrated: Console Application
//                                Integer and String Variable Declarations
//                                Application Command Line Parameters
//                                Case/Switch Statement
//                                String Literal Assignment and Concatenation
//                                Console Application Standard Output
//***************************************************************************************************************

//***************************************************************************************************************
// File: pp1_5.cpp
// Reserved
//***************************************************************************************************************


#include <afxwin.h>
#include <stdio.h>

extern int AFXAPI AfxWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
                             LPTSTR lpCmdLine,int nCmdShow);

int main(int argc, char* argv[])
{
   // Actual Entry Point of Execution
   return AfxWinMain(GetModuleHandle(NULL),NULL,GetCommandLine(),SW_SHOW);

}

class pp1_5 : public CWinApp
{


//***************************************************************************************************************
// Program Phase 1-5 Main
// Define the Entry Point of Execution (EPE) for Program Phase 1-5
// CBI:  1-5.1.1.1
//***************************************************************************************************************

virtual BOOL InitInstance()
{	
   this->m_pMainWnd = NULL;


//***************************************************************************************************************
// Program Phase 1-5 Main
// Declare the local variables for the "main" program
// CBI:  1-5.1.1.2
//***************************************************************************************************************

   int lnCmdLineParamCount;
   CString lcString1;
   CString lcString2;
   CString lcStringOutput1;
   CString lcStringOutput2;

 
//***************************************************************************************************************
// Program Phase 1-5 Main
// Store the command line parameters
// CBI:  1-5.1.1.3
//***************************************************************************************************************

   // The command line parameters can be accessed from the __argv array.
   lnCmdLineParamCount = __argc – 1;   


//***************************************************************************************************************
// Program Phase 1-5 Main
// Parse the command line parameters using a Case/Switch statement
// CBI:  1-5.1.1.4
//***************************************************************************************************************
   
   switch(lnCmdLineParamCount)
   {
      case 0:  
         lcStringOutput1 = "You entered no command line parameters.";
         break;

      case 1:  
         lcStringOutput1.Format("Command line parameter entered: %s",__argv[1]);

     
         break;

      default:
          lcStringOutput1 = "The command line is limited to 1 parameter.";
   }


//***************************************************************************************************************
// Program Phase 1-5 Main
// Concatenate two string variables
// CBI:  1-5.1.1.5
//***************************************************************************************************************

    lcString1 = "Hello";
    lcString2 = "World!";
    lcStringOutput2 = lcString1 + " " + lcString2;   


//***************************************************************************************************************
// Program Phase 1-5 Main
// Output to standard output
// CBI:  1-5.1.1.6
//***************************************************************************************************************

   fprintf(stdout,"%s \n",lcStringOutput1);
   fprintf(stdout,"%s \n",lcStringOutput2);

   return TRUE;
}};

pp1_5 goPp1_5;

 
 
  • pp1_6.cs: Program Phase 1-6 C# with .NET Framework Source Code


//***************************************************************************************************************
// Program Phase 1-6 C# Hello World! with Strings
// Programming Tasks Illustrated: Console Application
//                                Integer and String Variable Declarations
//                                Application Command Line Parameters
//                                Case/Switch Statement
//                                String Literal Assignment and Concatenation
//                                Console Application Standard Output
//***************************************************************************************************************

//***************************************************************************************************************
// File: pp1_6.cs
// Reserved
//***************************************************************************************************************

using System;

namespace nspp1_6
{
class pp1_6
{


//***************************************************************************************************************
// Program Phase 1-6 Main
// Define the Entry Point of Execution (EPE) for Program Phase 1-6
// CBI:  1-6.1.1.1
//***************************************************************************************************************

static void Main() 
{


//***************************************************************************************************************
// Program Phase 1-6 Main
// Declare the local variables for the "main" program
// CBI:  1-6.1.1.2
//***************************************************************************************************************

   int lnCmdLineParamCount;
   string[] argv;
   string lcString1;  
   string lcString2;
   string lcStringOutput1;
   string lcStringOutput2;


//***************************************************************************************************************
// Program Phase 1-6 Main
// Store the command line parameters
// CBI:  1-6.1.1.3
//***************************************************************************************************************
 
   argv = Environment.GetCommandLineArgs();

    
   lnCmdLineParamCount = argv.Length - 1;


//***************************************************************************************************************
// Program Phase 1-6 Main
// Parse the command line parameters using a Case/Switch statement
// CBI:  1-6.1.1.4
//***************************************************************************************************************

   switch (lnCmdLineParamCount)
   {
      case 0:
         lcStringOutput1 = "You entered no command line parameters.";
         break;

      case 1:
         lcStringOutput1 = "Command line parameter entered: " + argv[1];
         break;

      default:
         lcStringOutput1 = "The command line is limited to 1 parameter.";
         break;
   }


//***************************************************************************************************************
// Program Phase 1-6 Main
// Concatenate two string variables
// CBI:  1-6.1.1.5
//***************************************************************************************************************

   lcString1 = "Hello";
   lcString2 = "World!";
   lcStringOutput2 = lcString1 + " " + lcString2;   


//***************************************************************************************************************
// Program Phase 1-6 Main
// Output to standard output
// CBI:  1-6.1.1.6
//***************************************************************************************************************
   
   Console.WriteLine(lcStringOutput1);
   Console.WriteLine(lcStringOutput2);
}}}

 
 
  • pp1_7.vb: Program Phase 1-7 Visual Basic .NET Source Code


''***************************************************************************************************************
'' Program Phase 1-7 VB.NET Hello World! with Strings
'' Programming Tasks Illustrated: Console Application
''                                Integer and String Variable Declarations
''                                Application Command Line Parameters
''                                Case/Switch Statement
''                                String Literal Assignment and Concatenation
''                                Console Application Standard Output
''***************************************************************************************************************

''***************************************************************************************************************
'' File: pp1_7.vb
'' Reserved
''***************************************************************************************************************

Imports System
Namespace nspp1_7
Module pp1_7


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Define the Entry Point of Execution (EPE) for Program Phase 1-7
'' CBI:  1-7.1.1.1
''***************************************************************************************************************

Sub Main()


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Declare the local variables for the "main" program
'' CBI:  1-7.1.1.2
''***************************************************************************************************************

   Dim lnCmdLineParamCount As Integer
   Dim argv() As String
   Dim lcString1 As String
   Dim lcString2 As String
   Dim lcStringOutput1 As String
   Dim lcStringOutput2 As String


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Store the command line parameters
'' CBI:  1-7.1.1.3
''***************************************************************************************************************

   argv = System.Environment.GetCommandLineArgs()
   lnCmdLineParamCount = argv.Length – 1


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Parse the command line parameters using a Case/Switch statement
'' CBI:  1-7.1.1.4
''***************************************************************************************************************
   
   Select Case lnCmdLineParamCount

      Case 0
        lcStringOutput1 = "You entered no command line parameters."
  
      Case 1
         lcStringOutput1 = "Command line paramater entered:  " + argv(1)

      Case Else
         lcStringOutput1 = "The command line is limted to 1 parameter."

   End Select


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Concatenate two string variables
'' CBI:  1-7.1.1.5
''***************************************************************************************************************
   
   lcString1 = "Hello"
   lcString2 = "World!"
   lcStringOutput2 = lcString1 &amp;amp; lcString2


''***************************************************************************************************************
'' Program Phase 1-7 Main
'' Output to standard output
'' CBI:  1-7.1.1.6
''***************************************************************************************************************

   Console.WriteLine(lcStringOutput1)
   Console.WriteLine(lcStringOutput2)

End Sub
End Module
End Namespace



 
 
  • pp1_8.cpp: Program Phase 1-8 Managed C++ Source Code

//***************************************************************************************************************
// Program Phase 1-8 C++ Managed C++ Hello World! with Strings
// Programming Tasks Illustrated: Console Application
//                                Integer and String Variable Declarations
//                                Application Command Line Parameters
//                                Case/Switch Statement
//                                String Literal Assignment and Concatenation
//                                Console Application Standard Output
//***************************************************************************************************************

//***************************************************************************************************************
// File: pp1_8.cpp
// Reserved
//***************************************************************************************************************

#using <mscorlib.dll>
using namespace System;


//***************************************************************************************************************
// Program Phase 1-8 Main
// Define the Entry Point of Execution (EPE) for Program Phase 1-8
// CBI:  1-8.1.1.1
//***************************************************************************************************************

int main()
{


//***************************************************************************************************************
// Program Phase 1-8 Main
// Declare the local variables for the "main" program
// CBI:  1-8.1.1.2
//***************************************************************************************************************

   int lnCmdLineParamCount;
   cli::array <String^> ^laArgv;
   String^ lcString1;
   String^ lcString2;
   String^ lcStringOutput1;

   String^ lcStringOutput2;


//***************************************************************************************************************
// Program Phase 1-8 Main
// Store the command line parameters
// CBI:  1-8.1.1.3
//***************************************************************************************************************

   laArgv = Environment::GetCommandLineArgs(); 
   lnCmdLineParamCount = laArgv->Length - 1;


//***************************************************************************************************************
// Program Phase 1-8 Main
// Parse the command line parameters using a Case/Switch statement
// CBI:  1-8.1.1.4
//***************************************************************************************************************

   switch(lnCmdLineParamCount)
   {
      case 0:  
         lcStringOutput1 = "You entered no command line parameters.";
         break;

      case 1:
        lcStringOutput1 = String::Format("Command line parameter entered: {0}",
                                       laArgv[1]);
         break;

      default:
         lcStringOutput1 = "The command line is limited to 1 parameter.";
   }


//***************************************************************************************************************
// Program Phase 1-8 Main
// Concatenate two string variables
// CBI: 1-8.1.1.5
//***************************************************************************************************************

   lcString1 = "Hello";
   lcString2 = "World!";
   lcStringOutput2 = String::Format("{0} {1}",lcString1,lcString2);


//***************************************************************************************************************
// Program Phase 1-8 Main
// Output to standard output
// CBI:  1-8.1.1.6
//***************************************************************************************************************

   Console::WriteLine(lcStringOutput1);
   Console::WriteLine(lcStringOutput2);
   return 0;
}

 
 
  • pp1_9.py: Program Phase 1-9 Python Source Code


##***************************************************************************************************************
## Program Phase 1-9 Python Hello World! with Strings
## Programming Tasks Illustrated: Console Application
##                                Integer and String Variable Declarations
##                                Application Command Line Parameters
##                                Case/Switch Statement
##                                String Literal Assignment and Concatenation
##                                Console Application Standard Output
##***************************************************************************************************************

##***************************************************************************************************************
## File: pp1_9.py
## Reserved
##***************************************************************************************************************

import sys


##***************************************************************************************************************
## Program Phase 1-9 Main
## Define the Entry Point of Execution (EPE) for Program Phase 1-9
## CBI:  1-9.1.1.1
##***************************************************************************************************************

## The first line of the code in the pp1_9.py file is the EPE.


##***************************************************************************************************************
## Program Phase 1-9 Main
## Declare the local variables for the "main" program
## CBI:  1-9.1.1.2
##***************************************************************************************************************


lnCmdLineParamCount = 0
lcString1 = ""
lcStringOutput1 = ""
lcStringOutput2 = ""


##***************************************************************************************************************
## Program Phase 1-9 Main
## Store the command line parameters
## CBI:  1-9.1.1.3
##***************************************************************************************************************

## The sys.argv list contains the command line parameters.
lnCmdLineParamCount = len(sys.argv) - 1


##***************************************************************************************************************
## Program Phase 1-9 Main
## Parse the command line parameters using a Case/Switch statement
## CBI:  1-9.1.1.4
##***************************************************************************************************************

for lnCmdLineParamCount in [lnCmdLineParamCount]:
    
   if lnCmdLineParamCount == 0:
    
     lcStringOutput1 = "You entered no command line parameters."
     break

   if lnCmdLineParamCount == 1:
    
     lcStringOutput1 = "Command line paramater entered:  " + sys.argv[1];
     break

   # default
   lcStringOutput1 = "The command line is limited to 1 parameter."
   break


##***************************************************************************************************************
## Program Phase 1-9 Main
## Concatenate two string variables
## CBI: 1-9.1.1.5
##***************************************************************************************************************

lcString1 = "Hello"
lcString2 = "World!"
lcStringOutput2 = lcString1 + " " + lcString2   


##***************************************************************************************************************
## Program Phase 1-9 Main
## Output to standard output
## CBI:  1-9.1.1.6
##***************************************************************************************************************

print lcStringOutput1
print lcStringOutput2

 
 
  • pp1_10.pl: Program Phase 1-10 Perl Source Code


##***************************************************************************************************************
## Program Phase 1-10 Perl Hello World! with Strings
## Programming Tasks Illustrated: Console Application
##                                Integer and String Variable Declarations
##                                Application Command Line Parameters
##                                Case/Switch Statement
##                                String Literal Assignment and Concatenation
##                                Console Application Standard Output
##***************************************************************************************************************


##***************************************************************************************************************
## File: pp1_10.pl
## Reserved
##***************************************************************************************************************

use strict;


##***************************************************************************************************************
## Program Phase 1-10 Main
## Define the Entry Point of Execution (EPE) for Program Phase 1-10
## CBI:  1-10.1.1.1
##***************************************************************************************************************

## The first line of the code in the pp1_10.pl file is the EPE.


##***************************************************************************************************************
## Program Phase 1-10 Main
## Declare the local variables for the "main" program
## CBI:  1-10.1.1.2
##***************************************************************************************************************

my $lnCmdLineParamCount;
my $lcString1;
my $lcString2;
my $lcStringOutput1;
my $lcStringOutput2;


##***************************************************************************************************************
## Program Phase 1-10 Main
## Store the command line parameters
## CBI:  1-10.1.1.3
##***************************************************************************************************************

## The $ARGV array stores the command line parameters.
$lnCmdLineParamCount =  scalar(@ARGV);


##***************************************************************************************************************
## Program Phase 1-10 Main
## Parse the command line parameters using a Case/Switch statement
## CBI:  1-10.1.1.4
##***************************************************************************************************************

SWITCH:
{
   if($lnCmdLineParamCount == 0)
   {
      $lcStringOutput1 = "You entered no command line parameters.\n";
      last SWITCH;
   };

   if($lnCmdLineParamCount == 1)
   {

       $lcStringOutput1 = sprintf("Command line paramater entered:  %s\n",
                                  $ARGV[0]); 
      last SWITCH;
   };
  
   ## Otherwise
      $lcStringOutput1 = "The command line is limited to 1 parameter.\n";
}


##***************************************************************************************************************
## Program Phase 1-10 Main
## Concatenate two string variables
## CBI: 1-10.1.1.5
##***************************************************************************************************************

$lcString1 = "Hello";
$lcString2 = "World!";
$lcStringOutput2 = sprintf("%s %s\n",$lcString1,$lcString2);


##***************************************************************************************************************
## Program Phase 1-10 Main
## Output to standard output
## CBI:  1-10.1.1.6
##***************************************************************************************************************

print STDOUT $lcStringOutput1;   
print STDOUT $lcStringOutput2;