C# Visual Studio -The local driver's license office has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. B 2. D 3. A 4. A 5. C 6. A 7. B 8. A 9. C 10. D 11. B 12. C 13. D 14. A 15. D 16. C 17. C 18. B 19. D 20. A Your program should store these correct answers in an array. The program should read the student's answer's for each of the 20 questions from a text file and store the answers in an another array. (Create your own text file to test the application). After the student's answers have been read from the file, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam). It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions C# only please, please include form instructions with pictures of forms and labels for textboxes and buttons
Code
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.IO;
namespace License_test_result
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[] answeKey = { "B", "D", "A", "A", "C", "A", "B", "A", "C",
"D", "B", "C", "D", "A", "D", "C", "C", "B", "D", "A" };
private void btnResult_Click(object sender, EventArgs e)
{
string filename = txtFilename.Text;
string aLine;
string []studentAnswer=new string[20];
int count=0,correctCount=0,incorrectCount=0;
try
{
string path=Application.StartupPath+"\\"+filename;
var fileStream = new FileStream(path, FileMode.Open,
FileAccess.Read);
using (var streamReader = new StreamReader(fileStream,
Encoding.UTF8))
{
string line = string.Empty;
do
{
line = streamReader.ReadLine();
if (line != null)
{
studentAnswer[count] = line;
count++;
}
} while (line != null);
}
for (int i = 0; i < 20; i++)
{
if (answeKey[i] == studentAnswer[i])
correctCount++;
else
{
incorrectCount++;
lstIncorrectAns.Items.Add((i + 1));
}
}
txtCorrectAns.Text = correctCount.ToString();
txtIncorrectAns.Text = incorrectCount.ToString();
if (correctCount >= 15)
txtResult.Text = "Pass";
else
txtResult.Text = "Fail";
}
catch(Exception)
{
MessageBox.Show("File not found");
}
}
private void button1_Click(object sender, EventArgs e)
{
txtResult.Clear();
txtIncorrectAns.Clear();
txtFilename.Clear();
txtCorrectAns.Clear();
lstIncorrectAns.Items.Clear();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Form1.Designer,cs
namespace License_test_result
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should
be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.txtFilename = new System.Windows.Forms.TextBox();
this.btnResult = new System.Windows.Forms.Button();
this.txtCorrectAns = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtIncorrectAns = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtResult = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.lstIncorrectAns = new System.Windows.Forms.ListBox();
this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(89, 51);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(164, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Enter the test file name: ";
//
// txtFilename
//
this.txtFilename.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtFilename.Location = new System.Drawing.Point(268,
48);
this.txtFilename.Name = "txtFilename";
this.txtFilename.Size = new System.Drawing.Size(129, 21);
this.txtFilename.TabIndex = 1;
//
// btnResult
//
this.btnResult.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnResult.Location = new System.Drawing.Point(44, 370);
this.btnResult.Name = "btnResult";
this.btnResult.Size = new System.Drawing.Size(75, 23);
this.btnResult.TabIndex = 2;
this.btnResult.Text = "Show Result";
this.btnResult.UseVisualStyleBackColor = true;
this.btnResult.Click += new
System.EventHandler(this.btnResult_Click);
//
// txtCorrectAns
//
this.txtCorrectAns.Enabled = false;
this.txtCorrectAns.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtCorrectAns.Location = new System.Drawing.Point(268,
87);
this.txtCorrectAns.Name = "txtCorrectAns";
this.txtCorrectAns.Size = new System.Drawing.Size(54, 21);
this.txtCorrectAns.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(99, 90);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(145, 15);
this.label2.TabIndex = 3;
this.label2.Text = "Total correct Answer :";
//
// txtIncorrectAns
//
this.txtIncorrectAns.Enabled = false;
this.txtIncorrectAns.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtIncorrectAns.Location = new System.Drawing.Point(268,
130);
this.txtIncorrectAns.Name = "txtIncorrectAns";
this.txtIncorrectAns.Size = new System.Drawing.Size(54, 21);
this.txtIncorrectAns.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(89, 133);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(164, 15);
this.label3.TabIndex = 5;
this.label3.Text = "Total incorrect answers: ";
//
// txtResult
//
this.txtResult.Enabled = false;
this.txtResult.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtResult.Location = new System.Drawing.Point(269, 173);
this.txtResult.Name = "txtResult";
this.txtResult.Size = new System.Drawing.Size(54, 21);
this.txtResult.TabIndex = 8;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(196, 180);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 15);
this.label4.TabIndex = 7;
this.label4.Text = "Result: ";
//
// lstIncorrectAns
//
this.lstIncorrectAns.Font = new System.Drawing.Font("Microsoft Sans
Serif", 9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lstIncorrectAns.FormattingEnabled = true;
this.lstIncorrectAns.ItemHeight = 15;
this.lstIncorrectAns.Location = new System.Drawing.Point(268,
222);
this.lstIncorrectAns.Name = "lstIncorrectAns";
this.lstIncorrectAns.Size = new System.Drawing.Size(55, 94);
this.lstIncorrectAns.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label5.Location = new System.Drawing.Point(73, 222);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(183, 15);
this.label5.TabIndex = 10;
this.label5.Text = "Incorrect Question Number:";
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(212, 370);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 11;
this.button1.Text = "Clear";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif",
9F, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(380, 370);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 12;
this.button2.Text = "Exit";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new
System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(506, 416);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5);
this.Controls.Add(this.lstIncorrectAns);
this.Controls.Add(this.txtResult);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtIncorrectAns);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtCorrectAns);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnResult);
this.Controls.Add(this.txtFilename);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFilename;
private System.Windows.Forms.Button btnResult;
private System.Windows.Forms.TextBox txtCorrectAns;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtIncorrectAns;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtResult;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ListBox lstIncorrectAns;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}
Design

output
Student1.txt
If you have any query
regarding the code please ask me in the comment i am here for help
you. Please do not direct thumbs down just ask if you have any
query. And if you like my work then please appreciates with up
vote. Thank You.
C# Visual Studio -The local driver's license office has asked you to create an application that...
Using C++
1. Driver's The local driver's license office has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiple-choice questions. Here are the correct answers 16. C 17.С 18. B 19. D 20. A 1. B 2. D 3. A 12. C 13. D 14. A 15. D 7.В 9.С 10. D 5. С Your program should store these correct answers in an array. It should ask the...
please only use import java.util.Scanner
Driver's License Exam The local Driver's License Office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. A 2. D 3.В 4. B 5, C 6. В 7. A 8.В 9, C 10. D 12. C 13. D 14. B 15. D 16. С 18. A 19. D 20. B Your program should store...
Java: The local Driver's License Office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. B 6. A 11.B 16. C 2. D 7. B 12.C 17. C 3. A 8. A 13.D 18. B 4. A 9. C 14.A 19. D 5. C 10. D 15.D 20. A Your program should store the correct answers in an array. (Store each question's answer in an element of a String array.) The program...
License test The Los Angeles driver's license office has asked you to create an application that grades the written portion of the drivers license test. The test has 15 multiple-choice questions. Here are the correct answers (You may create your own correct answers if you like) 1. C 2. D 3. B 4. A 5. C 6. D 7. B 8. A 9. C 10. D 11. A 12. C 13. D 14. A 15. B A student must answer 10...
Visual Basic
zoow Driver's License Exam The local Registry of Motor Vehicles oflice has asked you to create an application that grades the written portion of the driver's license exam. The exam has 20 multiplc choice questions. Her ar the orrect answers to the questions: 6. A 7.13 8. A 9. C 10. D 16. С 12. C 13. D 14. A 15. D 2. D 3. A 5, C Your application should slore the correcl answers in an array....
PYTHON CODE PLEASEEEEE. Driver’s License Exam 20PTS PYTHON AND FLOWCHART The local driver’s license office has asked you to design a program that grades the written portion of the driver’s license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1.B 6.A 11.B 16.C 2.D 7.B 12.C 17.C 3.A 8.A 13.D 18.B 4.A 9.C 14.A 19.D 5.C 10.D 15.D 20.A Your program should store these correct answers in an array. (Store each question’s correct answer in...
Please answer Question 4 WITH A C# PROGRAM!!!!!!
THANK YOU!
File Edit View History Bookmarks Tools Help Share GEP IIIA Moorhead, MN 10-Day Weathe X N NDSU Faculty and Staff | North x D C#.NET - CSCI 213: Modern Sol X VitalSource Bookshelf: Starting x + + → OO - https://bookshelf.vitalsource.com/#/books/9780134400433/cf1/6 90% *** * Cambie Meble alle... S N 10 Crosby Derek Lam ... Alterna Caviar Anti-Ag... U C# Tutorial For Beginn... BE Celsius Fahrenheit con... Charter Club Sweater. Folklorama...
The local driver’s license office has asked you to write a program that grades the written portion of the driver’s license Rules and Signals Test. The driver license test has 25 multiple choice questions. The set of answer keys is: 1.A 6.B 11.C 16.B 2 21.B 2.C 7.C 12.A 17.A 22.C 3.B 8.D 13.B 18.C 23.A 4.B 9.A 14.C 19.A 24.D 5.D 10.B 15.A 20.D 25.B First, the application displays messages to ask for the information of current candidate about...
A - Write pseudocode B - Write A PYTHON PROGRAM Driver’s License Exam The local driver’s license office has asked you to design a program that grades the written portion of the driver’s license exam. The exam has 20 multiple choice questions. Here are the correct answers: B D A A C A B A C D B C D A D C C B D A Your program should store these correct answers in an array. (Store each question’s...
C# Visual Studio Problem You are given a file named USPopulation.txt. The file contains the midyear population of the United States, in thousands, during the years 1950 through 1990. The first line in the file contains the population for 1950, the second line contains the population for 1951, and so forth. Create an application that reads the file’s contents into an array or a List. The application should display the following data (statistics) in read-only textboxes. The average population during...