Complete MP5

master
Caleb Fontenot 2022-11-27 17:11:02 +07:00
parent 52d6e079df
commit ae12b42c28
153 changed files with 1344 additions and 215 deletions

@ -28,12 +28,90 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.openFileButton = new System.Windows.Forms.Button();
this.exitButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.correctAnswersLabel = new System.Windows.Forms.Label();
this.feedbackLabel = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// openFileButton
//
this.openFileButton.Location = new System.Drawing.Point(12, 106);
this.openFileButton.Name = "openFileButton";
this.openFileButton.Size = new System.Drawing.Size(93, 23);
this.openFileButton.TabIndex = 0;
this.openFileButton.Text = "Open File";
this.openFileButton.UseVisualStyleBackColor = true;
this.openFileButton.Click += new System.EventHandler(this.openFileButton_Click);
//
// exitButton
//
this.exitButton.Location = new System.Drawing.Point(111, 106);
this.exitButton.Name = "exitButton";
this.exitButton.Size = new System.Drawing.Size(97, 23);
this.exitButton.TabIndex = 1;
this.exitButton.Text = "Exit";
this.exitButton.UseVisualStyleBackColor = true;
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.correctAnswersLabel);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(196, 54);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Total Score";
//
// correctAnswersLabel
//
this.correctAnswersLabel.Location = new System.Drawing.Point(6, 19);
this.correctAnswersLabel.Name = "correctAnswersLabel";
this.correctAnswersLabel.Size = new System.Drawing.Size(184, 26);
this.correctAnswersLabel.TabIndex = 0;
this.correctAnswersLabel.Text = " ??/20";
this.correctAnswersLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// feedbackLabel
//
this.feedbackLabel.Location = new System.Drawing.Point(12, 69);
this.feedbackLabel.Name = "feedbackLabel";
this.feedbackLabel.Size = new System.Drawing.Size(196, 34);
this.feedbackLabel.TabIndex = 3;
this.feedbackLabel.Text = "Please open a text file containing Letter answers. (A,B,C,D)";
this.feedbackLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
this.ClientSize = new System.Drawing.Size(216, 136);
this.Controls.Add(this.feedbackLabel);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.exitButton);
this.Controls.Add(this.openFileButton);
this.Name = "Form1";
this.Text = "Grading Tool - Caleb Fontenot";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Button openFileButton;
private Button exitButton;
private GroupBox groupBox1;
private Label correctAnswersLabel;
private Label feedbackLabel;
private OpenFileDialog openFileDialog1;
}
}

@ -6,5 +6,80 @@ namespace DriversLicenseExam_CalebFontenot
{
InitializeComponent();
}
}
}
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void openFileButton_Click(object sender, EventArgs e)
{
// Create variables
string[] correctAnswers = new string[20],
studentAnswers = new string[20];
bool[] correctAnswerCompare = new bool[20];
// Read the file with the correct answers.
correctAnswers = readFiles("correctAnswers.txt");
// Now read the file with the student answers.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
studentAnswers = readFiles(openFileDialog1.FileName);
}
if (correctAnswers != null & studentAnswers != null)
{
for (int i = 0; i < correctAnswers.Length; i++)
{
if (correctAnswers[i] == studentAnswers[i])
{
correctAnswerCompare[i] = true;
}
else
{
correctAnswerCompare[i] = false;
}
}
// Count up the correct answers
int numCorrect = 0;
for (int i = 0; i < correctAnswerCompare.Length; i++)
{
if (correctAnswerCompare[i] == true)
{
numCorrect++;
}
}
correctAnswersLabel.Text = numCorrect.ToString() + "/20";
double gradePercentage = (numCorrect / 20.0);
feedbackLabel.Text = "You scored a " + gradePercentage.ToString("P");
} else
{
MessageBox.Show("Unable to open file(s).");
}
}
private string[] readFiles(string fileName)
{
try
{
// Create StreamReader to read the correct answers.
StreamReader inputFile = File.OpenText(fileName);
string[] returnStringArray = new string[20];
int i = 0;
while (!inputFile.EndOfStream)
{
returnStringArray[i] = inputFile.ReadLine();
i++;
}
inputFile.Close();
return returnStringArray;
} catch
{
return null;
}
}
}
}

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
@ -117,4 +57,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"DriversLicenseExam_CalebFontenot/1.0.0": {
"runtime": {
"DriversLicenseExam_CalebFontenot.dll": {}
}
}
}
},
"libraries": {
"DriversLicenseExam_CalebFontenot/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

@ -0,0 +1,15 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
]
}
}

@ -13,4 +13,4 @@ build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = DriversLicenseExam_CalebFontenot
build_property.ProjectDir = Z:\media\DataEXT4\Documents\ASDV C#\MP5\DriversLicenseExam_CalebFontenot\
build_property.ProjectDir = Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\

@ -0,0 +1,17 @@
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.csproj.AssemblyReference.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.Form1.resources
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.csproj.GenerateResource.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.GeneratedMSBuildEditorConfig.editorconfig
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.AssemblyInfoInputs.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.AssemblyInfo.cs
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.csproj.CoreCompileInputs.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\bin\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.exe
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\bin\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.deps.json
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\bin\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.runtimeconfig.json
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\bin\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.dll
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\bin\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.dll
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\refint\DriversLicenseExam_CalebFontenot.dll
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\DriversLicenseExam_CalebFontenot.genruntimeconfig.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\DriversLicenseExam_CalebFontenot\obj\Debug\net6.0-windows\ref\DriversLicenseExam_CalebFontenot.dll

@ -13,7 +13,8 @@
],
"additionalProbingPaths": [
"C:\\Users\\caleb\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\caleb\\.nuget\\packages"
"C:\\Users\\caleb\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configProperties": {
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true

@ -1,20 +1,24 @@
{
"format": 1,
"restore": {
"Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj": {}
"Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj": {}
},
"projects": {
"Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj": {
"Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectUniqueName": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectName": "DriversLicenseExam_CalebFontenot",
"projectPath": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectPath": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"packagesPath": "C:\\Users\\caleb\\.nuget\\packages\\",
"outputPath": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\obj\\",
"outputPath": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\caleb\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
@ -58,7 +62,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.402\\RuntimeIdentifierGraph.json"
}
}
}

@ -5,11 +5,12 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\caleb\.nuget\packages\</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\caleb\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\caleb\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>

@ -8,19 +8,24 @@
"net6.0-windows7.0": []
},
"packageFolders": {
"C:\\Users\\caleb\\.nuget\\packages\\": {}
"C:\\Users\\caleb\\.nuget\\packages\\": {},
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectUniqueName": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectName": "DriversLicenseExam_CalebFontenot",
"projectPath": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectPath": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"packagesPath": "C:\\Users\\caleb\\.nuget\\packages\\",
"outputPath": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\obj\\",
"outputPath": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\caleb\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
@ -64,7 +69,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.402\\RuntimeIdentifierGraph.json"
}
}
}

@ -1,8 +1,8 @@
{
"version": 2,
"dgSpecHash": "u5f6c9gkZ0+XUku02V0PmkwNcneL/4DvtaE7gj5x9i2uhQHQNxIHbNkL2M+QKOqNqfWOjZoCIM1LRsVhZjgmvw==",
"dgSpecHash": "y6TbHbwylq/Z2edPUMuehLuRkM7fvKo4n/8L6nfkAiqY9odYASJjOrsTP81UJrtnBjzv1LeAifVW3UpOG/S3bw==",
"success": true,
"projectFilePath": "Z:\\media\\DataEXT4\\Documents\\ASDV C#\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"projectFilePath": "Z:\\home\\caleb\\Documents\\ASDV-C-Sharp\\MP5\\DriversLicenseExam_CalebFontenot\\DriversLicenseExam_CalebFontenot.csproj",
"expectedPackageFiles": [],
"logs": []
}

Binary file not shown.

@ -37,9 +37,9 @@
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.resultLabel = new System.Windows.Forms.Label();
this.newGameButton = new System.Windows.Forms.Button();
this.resetButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
@ -49,7 +49,6 @@
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 56);
this.label1.TabIndex = 0;
this.label1.Text = "X";
//
// label2
//
@ -58,7 +57,6 @@
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 56);
this.label2.TabIndex = 1;
this.label2.Text = "X";
//
// label3
//
@ -67,7 +65,6 @@
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 56);
this.label3.TabIndex = 2;
this.label3.Text = "X";
//
// label4
//
@ -76,7 +73,6 @@
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(53, 56);
this.label4.TabIndex = 5;
this.label4.Text = "X";
//
// label5
//
@ -85,7 +81,6 @@
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(53, 56);
this.label5.TabIndex = 4;
this.label5.Text = "X";
//
// label6
//
@ -94,7 +89,6 @@
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(53, 56);
this.label6.TabIndex = 3;
this.label6.Text = "X";
//
// label7
//
@ -103,7 +97,6 @@
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(53, 56);
this.label7.TabIndex = 8;
this.label7.Text = "X";
//
// label8
//
@ -112,7 +105,6 @@
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(53, 56);
this.label8.TabIndex = 7;
this.label8.Text = "X";
//
// label9
//
@ -121,46 +113,45 @@
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(53, 56);
this.label9.TabIndex = 6;
this.label9.Text = "X";
//
// label10
// resultLabel
//
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 32.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label10.Location = new System.Drawing.Point(12, 254);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(297, 50);
this.label10.TabIndex = 9;
this.label10.Text = "Result";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label10.Click += new System.EventHandler(this.label10_Click);
this.resultLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 32.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.resultLabel.Location = new System.Drawing.Point(12, 254);
this.resultLabel.Name = "resultLabel";
this.resultLabel.Size = new System.Drawing.Size(297, 50);
this.resultLabel.TabIndex = 9;
this.resultLabel.Text = "Result";
this.resultLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
// newGameButton
//
this.button1.Location = new System.Drawing.Point(87, 338);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 30);
this.button1.TabIndex = 10;
this.button1.Text = "New Game";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.newGameButton.Location = new System.Drawing.Point(87, 338);
this.newGameButton.Name = "newGameButton";
this.newGameButton.Size = new System.Drawing.Size(75, 30);
this.newGameButton.TabIndex = 10;
this.newGameButton.Text = "New Game";
this.newGameButton.UseVisualStyleBackColor = true;
this.newGameButton.Click += new System.EventHandler(this.newGameButton_Click);
//
// button2
// resetButton
//
this.button2.Location = new System.Drawing.Point(168, 338);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 30);
this.button2.TabIndex = 11;
this.button2.Text = "Reset";
this.button2.UseVisualStyleBackColor = true;
this.resetButton.Location = new System.Drawing.Point(168, 338);
this.resetButton.Name = "resetButton";
this.resetButton.Size = new System.Drawing.Size(75, 30);
this.resetButton.TabIndex = 11;
this.resetButton.Text = "Reset";
this.resetButton.UseVisualStyleBackColor = true;
this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(321, 412);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label10);
this.Controls.Add(this.resetButton);
this.Controls.Add(this.newGameButton);
this.Controls.Add(this.resultLabel);
this.Controls.Add(this.label7);
this.Controls.Add(this.label8);
this.Controls.Add(this.label9);
@ -187,9 +178,9 @@
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label resultLabel;
private System.Windows.Forms.Button newGameButton;
private System.Windows.Forms.Button resetButton;
}
}

@ -20,18 +20,35 @@ namespace TTT
InitializeComponent();
}
private void label10_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
private void newGameButton_Click(object sender, EventArgs e)
{
populateArray();
displayBoard();
//displayBoard();
while (determineWinner() == -1)
;//relaod table
{
//reload table
resultLabel.Text = "Undetermined";
populateArray();
}
if (determineWinner() == 0)
{
resultLabel.Text = "O Wins!";
}
else if (determineWinner() == 1)
{
resultLabel.Text = "X Wins!";
}
else if (determineWinner() == 2)
{
resultLabel.Text = "Draw";
}
else
{
resultLabel.Text = "Undetermined";
}
displayBoard();
}
void populateArray()
@ -55,80 +72,170 @@ namespace TTT
int winsOfX = 0;
int winsOfO = 0;
if (this.board[0, 0] == 1 &&
this.board[0, 1] == 1 &&
this.board[0, 2] == 1)
//count all wins of X
// Wins on x axis
if (this.board[0, 0] == 1 &&
this.board[0, 1] == 1 &&
this.board[0, 2] == 1)
winsOfX++;
if (this.board[1, 0] == 1 &&
this.board[1, 1] == 1 &&
this.board[1, 2] == 1)
this.board[1, 1] == 1 &&
this.board[1, 2] == 1)
winsOfX++;
//count all wins of X
//count all the wins of 0
if (this.board[2, 0] == 1 &&
this.board[2, 1] == 1 &&
this.board[2, 2] == 1)
winsOfX++;
// Count all wins for O
//wins on y axis
if (this.board[0, 0] == 0 &&
this.board[1, 0] == 0 &&
this.board[2, 0] == 0)
winsOfO++;
if (this.board[0, 1] == 0 &&
this.board[1, 1] == 0 &&
this.board[2, 1] == 0)
winsOfO++;
if (winsOfX == 1 && winsOfO == 0)
;//x wins
if (this.board[0, 2] == 0 &&
this.board[1, 2] == 0 &&
this.board[2, 2] == 0)
winsOfO++;
if (this.board[0, 0] == 0 &&
this.board[0, 1] == 0 &&
this.board[0, 2] == 0)
winsOfO++;
if (this.board[1, 0] == 0 &&
this.board[1, 1] == 0 &&
this.board[1, 2] == 0)
winsOfO++;
if (this.board[2, 0] == 0 &&
this.board[2, 1] == 0 &&
this.board[2, 2] == 0)
winsOfO++;
//wins on y axis
if (this.board[0, 0] == 0 &&
this.board[1, 0] == 0 &&
this.board[2, 0] == 0)
winsOfO++;
if (this.board[0, 1] == 0 &&
this.board[1, 1] == 0 &&
this.board[2, 1] == 0)
winsOfO++;
if (this.board[0, 2] == 0 &&
this.board[1, 2] == 0 &&
this.board[2, 2] == 0)
winsOfO++;
if (winsOfX == 1 && winsOfO == 0) //x wins
{
return 1;
}
else if (winsOfX == 0 && winsOfO == 1) //o wins
{
return 0;
}
else if (winsOfX == 1 && winsOfO == 1) // Draw
{
return 2;
}
else // Invalid combination
{
return -1;
}
else if (winsOfX == 0 && winsOfO == 1)
;//o wins
else if (winsOfX == 1 && winsOfO == 1)
;//draw
else
;//invalid combination , rload the table with 0's and 1's
return 1;
}
void displayBoard()
void displayBoard()
{
if (board[0, 0] == 0)
label1.Text = "O";
else
else if(board[0, 0] == 1)
label1.Text = "X";
else
label1.Text = "";
if (board[0, 1] == 0)
label2.Text = "O";
else
else if (board[0,1] == 1)
label2.Text = "X";
else
label2.Text = "";
if (board[0, 2] == 0)
label3.Text = "O";
else
else if (board[0,2] == 1)
label3.Text = "X";
else
label3.Text = "";
if (board[1, 0] == 0)
label4.Text = "O";
else
else if (board[1,0] == 1)
label4.Text = "X";
else
label4.Text = "";
if (board[1, 1] == 0)
label5.Text = "O";
else
else if (board[1,1] == 1)
label5.Text = "X";
else
label5.Text = "";
if (board[1, 2] == 0)
label6.Text = "O";
else
else if (board[1,2] == 1)
label6.Text = "X";
else
label6.Text = "";
if (board[2, 0] == 0)
label7.Text = "O";
else
else if (board[2,0] == 1)
label7.Text = "X";
else
label7.Text = "";
if (board[2, 1] == 0)
label8.Text = "O";
else
else if (board[2,1] == 1)
label8.Text = "X";
else
label8.Text = "";
if (board[2, 2] == 0)
label9.Text = "O";
else
else if (board[2,2] == 1)
label9.Text = "X";
else
label9.Text = "";
}
private void resetButton_Click(object sender, EventArgs e)
{
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 3; y++)
board[x, y] = -1;
}
displayBoard();
resultLabel.Text = "";
}
}
}

Binary file not shown.

Binary file not shown.

@ -8,3 +8,14 @@ C:\Users\athanasios.markou\source\repos\TTT\obj\Debug\TTT.csproj.GenerateResourc
C:\Users\athanasios.markou\source\repos\TTT\obj\Debug\TTT.csproj.CoreCompileInputs.cache
C:\Users\athanasios.markou\source\repos\TTT\obj\Debug\TTT.exe
C:\Users\athanasios.markou\source\repos\TTT\obj\Debug\TTT.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\bin\Debug\TTT.exe.config
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\bin\Debug\TTT.exe
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\bin\Debug\TTT.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.csproj.AssemblyReference.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.csproj.SuggestedBindingRedirects.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.Form1.resources
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.Properties.Resources.resources
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.csproj.GenerateResource.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.csproj.CoreCompileInputs.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.exe
Z:\home\caleb\Documents\ASDV-C-Sharp\MP5\TTT\obj\Debug\TTT.pdb

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Seating_Chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void displayPriceButton_Click(object sender, EventArgs e)
{
// Variables for the selected row and column
int row, col;
const int MAX_ROW = 5;
const int MAX_COL = 3;
// Create an array with the seat prices
decimal[,] prices =
{
{450m, 450m, 450m, 450m },
{425 }
}
}
}

@ -1,7 +0,0 @@
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\bin\Debug\Seating Chart.exe
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\bin\Debug\Seating Chart.pdb
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating_Chart.Form1.resources
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating_Chart.Properties.Resources.resources
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.csproj.GenerateResource.Cache
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.exe
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.pdb

Binary file not shown.

Binary file not shown.

@ -33,8 +33,8 @@
this.seatPriceDescriptionLabel = new System.Windows.Forms.Label();
this.colPromptLabel = new System.Windows.Forms.Label();
this.rowPromptLabel = new System.Windows.Forms.Label();
this.txtCol = new System.Windows.Forms.TextBox();
this.txtRow = new System.Windows.Forms.TextBox();
this.colTextBox = new System.Windows.Forms.TextBox();
this.rowTextBox = new System.Windows.Forms.TextBox();
this.exitButton = new System.Windows.Forms.Button();
this.displayPriceButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.airplanePictureBox)).BeginInit();
@ -89,19 +89,19 @@
this.rowPromptLabel.TabIndex = 18;
this.rowPromptLabel.Text = "Enter a Row";
//
// txtCol
// colTextBox
//
this.txtCol.Location = new System.Drawing.Point(92, 45);
this.txtCol.Name = "txtCol";
this.txtCol.Size = new System.Drawing.Size(64, 20);
this.txtCol.TabIndex = 17;
this.colTextBox.Location = new System.Drawing.Point(92, 45);
this.colTextBox.Name = "colTextBox";
this.colTextBox.Size = new System.Drawing.Size(64, 20);
this.colTextBox.TabIndex = 17;
//
// txtRow
// rowTextBox
//
this.txtRow.Location = new System.Drawing.Point(92, 19);
this.txtRow.Name = "txtRow";
this.txtRow.Size = new System.Drawing.Size(64, 20);
this.txtRow.TabIndex = 16;
this.rowTextBox.Location = new System.Drawing.Point(92, 19);
this.rowTextBox.Name = "rowTextBox";
this.rowTextBox.Size = new System.Drawing.Size(64, 20);
this.rowTextBox.TabIndex = 16;
//
// exitButton
//
@ -111,6 +111,7 @@
this.exitButton.TabIndex = 23;
this.exitButton.Text = "Exit";
this.exitButton.UseVisualStyleBackColor = true;
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// displayPriceButton
//
@ -133,8 +134,8 @@
this.Controls.Add(this.seatPriceDescriptionLabel);
this.Controls.Add(this.colPromptLabel);
this.Controls.Add(this.rowPromptLabel);
this.Controls.Add(this.txtCol);
this.Controls.Add(this.txtRow);
this.Controls.Add(this.colTextBox);
this.Controls.Add(this.rowTextBox);
this.Controls.Add(this.airplanePictureBox);
this.Name = "Form1";
this.Text = "Seating Chart";
@ -151,8 +152,8 @@
internal System.Windows.Forms.Label seatPriceDescriptionLabel;
internal System.Windows.Forms.Label colPromptLabel;
internal System.Windows.Forms.Label rowPromptLabel;
internal System.Windows.Forms.TextBox txtCol;
internal System.Windows.Forms.TextBox txtRow;
internal System.Windows.Forms.TextBox colTextBox;
internal System.Windows.Forms.TextBox rowTextBox;
internal System.Windows.Forms.Button exitButton;
internal System.Windows.Forms.Button displayPriceButton;
}

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Seating_Chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void displayPriceButton_Click(object sender, EventArgs e)
{
// Variables for the selected row and column
int row, col;
const int MAX_ROW = 5;
const int MAX_COL = 3;
// Create an array with the seat prices
decimal[,] prices =
{
{ 450m, 450m, 450m, 450m },
{ 425m, 425m, 425m, 425m },
{ 400m, 400m, 400m, 400m },
{ 375m, 375m, 375m, 475m },
{ 375m, 375m, 375m, 475m },
{ 350m, 350m, 350m, 450m }
};
// Get the selected row number.
if (int.TryParse(rowTextBox.Text, out row))
{
// Get the selected column number.
if (int.TryParse(colTextBox.Text, out col))
{
// Make sure the row is within range.
if (row >= 0 && row <= MAX_ROW)
{
if (col >= 0 && col <= MAX_COL)
{
// Display the selected seat's price.
priceLabel.Text = prices[row, col].ToString("c");
}
else
{
// Error message for invalid column.
MessageBox.Show("Column must be 0 through " + MAX_COL);
}
}
else
{
// Error message for invalid row.
MessageBox.Show("Column must be 0 through " + MAX_ROW);
}
}
else
{
// Display an error message for noninteger column.
MessageBox.Show("Enter an integer for the column.");
}
}
else
{
// Display an error message for noninteger row.
MessageBox.Show("Enter an integer for the row.");
}
}
private void exitButton_Click(object sender, EventArgs e)
{
// Close the form.
this.Close();
}
}
}

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

@ -0,0 +1,18 @@
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\bin\Debug\Seating Chart.exe
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\bin\Debug\Seating Chart.pdb
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating_Chart.Form1.resources
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating_Chart.Properties.Resources.resources
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.csproj.GenerateResource.Cache
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.exe
C:\Users\Tony\Documents\Books\C#\4th Edition\Student Sample Programs\Chap07\Seating Chart\Seating Chart\obj\x86\Debug\Seating Chart.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\bin\Debug\lab7_3_CalebFontenot.exe.config
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\bin\Debug\lab7_3_CalebFontenot.exe
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\bin\Debug\lab7_3_CalebFontenot.pdb
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating Chart.csproj.AssemblyReference.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating Chart.csproj.SuggestedBindingRedirects.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating_Chart.Form1.resources
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating_Chart.Properties.Resources.resources
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating Chart.csproj.GenerateResource.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\Seating Chart.csproj.CoreCompileInputs.cache
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\lab7_3_CalebFontenot.exe
Z:\home\caleb\Documents\ASDV-C-Sharp\lab7_2\lab7_3_CalebFontenot\Seating Chart\obj\x86\Debug\lab7_3_CalebFontenot.pdb

Some files were not shown because too many files have changed in this diff Show More