diff options
5 files changed, 181 insertions, 0 deletions
diff --git a/Sait.Cmpp297.MoKhan.Assignment1.sln b/Sait.Cmpp297.MoKhan.Assignment1.sln new file mode 100644 index 0000000..728250b --- /dev/null +++ b/Sait.Cmpp297.MoKhan.Assignment1.sln @@ -0,0 +1,24 @@ +
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sait.Cmpp297.Assignment1.AsterikPatterns", "src\app\Sait.Cmpp297.Assignment1.AsterikPatterns\Sait.Cmpp297.Assignment1.AsterikPatterns.csproj", "{5580C71C-9D30-45D5-90AC-17FB2141F39E}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {5580C71C-9D30-45D5-90AC-17FB2141F39E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5580C71C-9D30-45D5-90AC-17FB2141F39E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5580C71C-9D30-45D5-90AC-17FB2141F39E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5580C71C-9D30-45D5-90AC-17FB2141F39E}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Assignment.txt b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Assignment.txt new file mode 100644 index 0000000..69d488a --- /dev/null +++ b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Assignment.txt @@ -0,0 +1,15 @@ +Page. 269
+6.15
+Write an application that displays the folowing patterns separately, one below the other.
+Use for loops to generate the patterns.
+All asterisks (*) should be printed by a single statement of the form :
+ - Console.Write("*");
+ - which causes the asterisks to print side by side.
+- A statement of the form:
+ - Console.WriteLine();
+ - can be used to move to the next line.
+- A statement of the form :
+ - Console.Write( ' ' );
+ - can be used to display a space for the last two patterns.
+- There should be no other output statements in the application.
+[ hint: the last two patterns require that each line begin with an appropriate number of blank spaces. ]
\ No newline at end of file diff --git a/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Program.cs b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Program.cs new file mode 100644 index 0000000..a5a2a51 --- /dev/null +++ b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Program.cs @@ -0,0 +1,59 @@ +/*
+ * Created by: Mo Khan
+ * Created: Saturday, May 26, 2007
+ */
+using System;
+
+namespace Sait.Cmpp297.Assignment1.AsterikPatterns {
+ internal class Program {
+ #region Public Methods
+
+ public static void Main( ) {
+ OutputAC( delegate( Int32 xAxis, Int32 i ) { return ( xAxis < i + 1 ); } );
+
+ OutputBD( delegate( Int32 xAxis, Int32 i ) { return ( xAxis < i ); } );
+
+ OutputAC( delegate( Int32 xAxis, Int32 i ) { return ( xAxis >= i ); } );
+
+ OutputBD( delegate( Int32 xAxis, Int32 i ) { return ( i <= xAxis + 1 ); } );
+ Console.ReadLine( );
+ }
+
+ #endregion
+
+ #region Private Fields
+
+ private delegate Boolean CheckCondition( Int32 xAxis, Int32 charactersPerRow );
+
+ #endregion
+
+ #region Private Methods
+
+ private static void OutputAC( CheckCondition condition ) {
+ Int32 charactersPerRow = 0;
+ // loop through the y axis from row 0 to 10
+ for ( int yAxis = 0; yAxis < 10; yAxis++ ) {
+ // loop through x axis from column 0 to 10 for each row.
+ for ( int xAxis = 0; xAxis < 10; xAxis++ ) {
+ // write the character for the current position
+ Console.Write( condition( xAxis, charactersPerRow ) ? "*" : " " );
+ }
+ ++charactersPerRow;
+ Console.WriteLine( );
+ }
+ }
+
+ private static void OutputBD( CheckCondition condition ) {
+ Int32 charactersPerRow = 10;
+ for ( int yAxis = 0; yAxis < 10; yAxis++ ) {
+ for ( int xAxis = 0; xAxis < 10; xAxis++ ) {
+ Console.Write( condition( xAxis, charactersPerRow ) ? "*" : " " );
+ }
+ --charactersPerRow;
+ Console.WriteLine( );
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file diff --git a/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Properties/AssemblyInfo.cs b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1976d1f --- /dev/null +++ b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly : AssemblyTitle( "Sait.Cmpp297.Assignment1.AsterikPatterns" )]
+[assembly : AssemblyDescription( "" )]
+[assembly : AssemblyConfiguration( "" )]
+[assembly : AssemblyCompany( "http://mokhan.ca/" )]
+[assembly : AssemblyProduct( "Sait.Cmpp297.Assignment1.AsterikPatterns" )]
+[assembly : AssemblyCopyright( "Copyright © Mo Khan 2007" )]
+[assembly : AssemblyTrademark( "" )]
+[assembly : AssemblyCulture( "" )]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly : ComVisible( false )]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly : Guid( "cfe8c66c-c457-46a5-8744-a7b1298d3bcc" )]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly : AssemblyVersion( "1.0.0.0" )]
+[assembly : AssemblyFileVersion( "1.0.0.0" )]
+[assembly : CLSCompliant( true )]
\ No newline at end of file diff --git a/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Sait.Cmpp297.Assignment1.AsterikPatterns.csproj b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Sait.Cmpp297.Assignment1.AsterikPatterns.csproj new file mode 100644 index 0000000..c36fc0c --- /dev/null +++ b/src/app/Sait.Cmpp297.Assignment1.AsterikPatterns/Sait.Cmpp297.Assignment1.AsterikPatterns.csproj @@ -0,0 +1,50 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{5580C71C-9D30-45D5-90AC-17FB2141F39E}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Sait.Cmpp297.Assignment1.AsterikPatterns</RootNamespace>
+ <AssemblyName>Sait.Cmpp297.Assignment1.AsterikPatterns</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Assignment.txt" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file |
