-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Bloom
committed
Feb 19, 2019
1 parent
27b588b
commit 6b9bbe4
Showing
12 changed files
with
836 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28010.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numeric_MemoryRecall", "Numeric_MemoryRecall\Numeric_MemoryRecall.csproj", "{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E1CDBA7B-E63E-4066-BFE2-CE76166DC774}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {DEBE45B5-9091-43A2-8A7C-7B1DBC892E65} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using System.Speech.Synthesis; | ||
namespace CritiCall_MemoryRecall | ||
{ | ||
public partial class Form1 : Form | ||
{ | ||
public string phoneNumber; | ||
public int correct = 0; | ||
public int wrong = 0; | ||
public int tryCounter = 0; | ||
|
||
SpeechSynthesizer reader = new SpeechSynthesizer(); | ||
|
||
|
||
public Form1() | ||
{ | ||
InitializeComponent(); | ||
btnVerify.Enabled = false; | ||
txtPhone.Enabled = false; | ||
|
||
lblCorrect.Text = correct.ToString(); | ||
lblWrong.Text = wrong.ToString(); | ||
lblNumber.Text = ""; | ||
} | ||
|
||
private void btnBegin_Click(object sender, EventArgs e) | ||
{ | ||
if(btnBegin.Text == "Reset") | ||
{ | ||
lblCorrect.Text = "0"; | ||
lblWrong.Text = "0"; | ||
correct = 0; | ||
wrong = 0; | ||
tryCounter = 0; | ||
lblNumber.Text = ""; | ||
txtPhone.Text = ""; | ||
btnBegin.Text = "Begin"; | ||
} | ||
else | ||
{ | ||
btnBegin.Enabled = false; | ||
btnBegin.Text = "Reset"; | ||
RunTest(); | ||
btnBegin.Enabled = true; | ||
} | ||
} | ||
public void RunTest() | ||
{ | ||
|
||
phoneNumber = GenerateNumber(); | ||
|
||
reader.Rate = -2; | ||
lblNumber.Text = ""; | ||
reader.Speak(phoneNumber); | ||
btnVerify.Enabled = true; | ||
txtPhone.Enabled = true; | ||
txtPhone.Focus(); | ||
btnVerify.Text = "Verify"; | ||
} | ||
public string GenerateNumber() | ||
{ | ||
Random random = new Random(); | ||
string r = ""; | ||
int i; | ||
for (i = 1; i < 8; i++) | ||
{ | ||
r += random.Next(0, 9).ToString(); | ||
} | ||
return r; | ||
} | ||
|
||
public char LetterGradeFromNumber(double marks) | ||
{ | ||
if (marks >= 90) | ||
return 'A'; | ||
else if (marks >= 80) | ||
return 'B'; | ||
else if (marks >= 70) | ||
return 'C'; | ||
else if (marks >= 60) | ||
return 'D'; | ||
else if (marks >= 0) | ||
return 'F'; | ||
else | ||
return 'U'; // unclassified | ||
} | ||
|
||
private void btnVerify_Click(object sender, EventArgs e) | ||
{ | ||
if (tryCounter == 10) | ||
{ | ||
txtPhone.Text = ""; | ||
txtPhone.Enabled = false; | ||
btnVerify.Enabled = false; | ||
txtPhone.Enabled = false; | ||
|
||
double avg = (double)correct / (double)10; | ||
|
||
double finalscore = avg * (double)100; | ||
char score = LetterGradeFromNumber(finalscore); | ||
|
||
string message = "Your Score is: " + finalscore.ToString() +"%\nYour grade is: " + score + "\nYou had " + wrong.ToString() + " incorrect"; | ||
|
||
MessageBox.Show(message,"Final Results", MessageBoxButtons.OK,MessageBoxIcon.Information); | ||
|
||
|
||
} | ||
else | ||
{ | ||
if (btnVerify.Text == "Next") | ||
{ | ||
txtPhone.Text = ""; | ||
txtPhone.Enabled = false; | ||
btnVerify.Enabled = false; | ||
RunTest(); | ||
} | ||
else | ||
{ | ||
if (txtPhone.Text == phoneNumber) | ||
{ | ||
|
||
|
||
lblNumber.Text = phoneNumber; | ||
correct += 1; | ||
tryCounter += 1; | ||
System.Media.SystemSounds.Question.Play(); | ||
MessageBox.Show("Correct"); | ||
|
||
lblCorrect.Text = correct.ToString(); | ||
lblWrong.Text = wrong.ToString(); | ||
txtPhone.Enabled = false; | ||
btnVerify.Text = "Next"; | ||
} | ||
else | ||
{ | ||
lblNumber.Text = phoneNumber; | ||
wrong += 1; | ||
tryCounter += 1; | ||
System.Media.SystemSounds.Exclamation.Play(); | ||
MessageBox.Show("Incorrect"); | ||
lblCorrect.Text = correct.ToString(); | ||
lblWrong.Text = wrong.ToString(); | ||
txtPhone.Enabled = false; | ||
btnVerify.Text = "Next"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void Form1_Load(object sender, EventArgs e) | ||
{ | ||
|
||
} | ||
|
||
private void label2_Click(object sender, EventArgs e) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.