Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

In this exercise, create a form that accepts one or more scores from the user. Each time score added the score total, score count, average score and letter grade calculated and displayed. Figure 1...

1 answer below »

In this exercise, create a form that accepts one or more scores from the user. Each time score added the score total, score count, average score and letter grade calculated and displayed.

Figure 1Score Calculator Form

1. Start a new project named ScoreCalculator.

2. Add labels, text boxes, and buttons to the default form and set the properties of the form and its controls so they appear as shown above. Controls are to have meaningful names.

3. Rename the form to frmScoreCalculator. When ask to modify any references to the form, click the Yes button.

4. When the user presses the Enter key, the Click event of the Add button should fire. When the user presses the Esc key, the Click event of the Exit button should fire.

5. Declare two class variables to store the score total and the score count.

6. Create an event handler for the Click event of the Add button. This event handler should get the score the user enters, calculate, and display the score total, score count, average score, letter grade, and move the focus to the Score text box. It should provide for integer entries, but you can assume that the user will enter valid integer values. The letter grade ranges are:

Letter grade

average

A

XXXXXXXXXX

B

80 - 89

C

70 – 79

D

60 – 69

F

59 - 0

7. Create an event handler for the Click event of the Clear Scores button. This event handler should set the two class variables to zero, clear the text boxes on the form, and move the focus to the Score text box.

8. Create an event handler for the Click event of the Exit button that closes the form.

9. Test the application to be sure it works correctly.

10. Include a header and meaningful comments throughout your program. The header includes your first and last name, date program completed, and a summary of the program. Example in Figure 2.

Figure 2 Header using block comments

11. Zip the entire project folder before submitting to the drop box. Do not go inside the folder created when the project created. To zip right click on the folder -> Click Sent to -> Click Compressed (zipped) folder. Do not go inside the zipped folder to run the program the program compressed. To run the program again, go back to the original folder not zipped.

Answered Same Day Sep 19, 2021

Solution

Aditya answered on Sep 20 2021
159 Votes
ScoreCalculato
.vs/ScoreCalculato
v16/.suo
ScoreCalculato
ScoreCalculator.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScoreCalculator", "ScoreCalculator\ScoreCalculator.csproj", "{8F504124-A1AB-4B5F-99D8-323091F14A27}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {8F504124-A1AB-4B5F-99D8-323091F14A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {8F504124-A1AB-4B5F-99D8-323091F14A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {8F504124-A1AB-4B5F-99D8-323091F14A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {8F504124-A1AB-4B5F-99D8-323091F14A27}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {F7776E4A-2549-4D52-804A-B10D7EEEC9F5}
    EndGlobalSection
EndGlobal
ScoreCalculato
ScoreCalculato
App.config




ScoreCalculato
ScoreCalculato
in/Debug/ScoreCalculator.exe
ScoreCalculato
ScoreCalculato
in/Debug/ScoreCalculator.exe.config




ScoreCalculato
ScoreCalculato
in/Debug/ScoreCalculator.pd
ScoreCalculato
ScoreCalculato
Form1.cs
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;
namespace ScoreCalculato
{
public partial class Form1 : Form
{
int scoreCount = 0;
int scoreTotal = 0;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
private void button2_Click(object sender, EventArgs e)
{
scoreCount = 0;
scoreTotal = 0;
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
}
private void button1_Click_1(object sender, EventArgs e)
{
String smarks = textBox1.Text;
int marks = Convert.ToInt32(smarks);
scoreTotal = scoreTotal + marks;
scoreCount++;
int average = scoreTotal / scoreCount;
char grade = ' ';
if ((average >= 90) && (average <= 100))
{
grade = 'A';
}
else if ((average >= 80) && (average <= 89))
{
grade = 'B';
}
else if ((average >= 70) && (average <= 79))
{
grade = 'C';
}
else if ((average >= 60) && (average <= 69))
{
grade = 'D';
}
else if ((average >= 0) && (average <= 59))
{
grade = 'F';
}
textBox2.Text = scoreTotal.ToString();
textBox3.Text = scoreCount.ToString();
textBox4.Text = average.ToString();
textBox5.Text = grade.ToString();
}
}
}
ScoreCalculato
ScoreCalculato
Form1.Designer.cs
namespace ScoreCalculato
{
partial class Form1
{


Required designer variable.


summary
private System.ComponentModel.IContainer components = null;


Clean up any resources being used.


summary

true if managed resources should be disposed; otherwise, false.
param
protected ove
ide void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code


Required method for Designer support - do not modify

the contents of this method with the code editor.


summary
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();



label2


this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(179, 87);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Score total: ";



label4


this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(179, 145);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(47, 13);
this.label4.TabIndex = 3;
this.label4.Text = "Average";



label5


this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(179, 176);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(70, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Letter grade: ";



textBox1


this.textBox1.Location = new System.Drawing.Point(264, 56);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(68, 20);
this.textBox1.TabIndex = 5;



textBox2


this.textBox2.Location = new System.Drawing.Point(264, 84);
this.textBox2.Name =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here