Question

In: Computer Science

C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017...

C#

What to submit:

One zip file named Ass3.zip

This zip must contain one VS 2017 solution named Ass3, which contains one C# Windows Forms App project also named Ass3 and the project contains a default form, Form1.cs and Program.cs.

No change should be made in Program.cs, but your Form1 must be designed and implemented to satisfy the following requirements.

**Do not submit only a single file of the solution or project. The whole solution folder of VS 2017 must be zipped and submitted for grading.

Requirements:

  1. Use VS 2017 to create a C# Windows Forms App project whose solution and project are named Ass3. When all requirements below are finished and tested, zip the entire solution as Ass3.zip and upload it for grading.
  2. Use the same Functional Requirement as described in Assignment 2 with the changes below.
  3. Except the Form1 class given by Visual Studio, no other classes need to be defined. That is, the program you did in Assignment 2, including data and methods of the two classes should be "transplanted" in the Form1 class of this Ass3 project.
  4. All input and output should be done within Form1 and visual controls (e.g., textboxes, labels, buttons, etc.) on the form. That is, no console is used--no more command line I/O and no display in the Command Prompt.
  5. Specifically, the two initial integers and each guess should be entered in a corresponding textbox (i.e., three textboxes in total) and the error message "You must enter a number between ... and ...!" will be displayed by a label in red. A second label should be used to display in blue the hint "Higher...", "Lower...", and "You win!". Finally, let the ending message "----End of Game----" be displayed in the form title (in black since title color cannot be changed).
  6. Set the font size of all visual controls to be 18 points.
  7. Add a button showing 'Generate Secrete Number' to create a secrete number every time it is clicked. Because this button can be clicked at any time, there might be an error or hint displayed from the previous play, this button should also erase both labels to empty and reset the form title to 'Form1' when clicked.
  8. To accept a guess, a second button showing 'Guess' should be added on the form. Each time when it is clicked, it first erases the labels from their previous display and then show the error and/or hint message, depending on the guess entered.
  9. Place each visual control in Form1 so they look like the form shown in the demo program attached below.
  10. Same as in Assignment 2, we assume there are always two valid input integers entered to define the range of the random secrete number, and an integer is always entered as the guess value. That means there is no need to validate all three input integers except the guess value could still be out of the range, which explains (in item 5 above) why an error message needs to be displayed.

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Here a new Windows Forms Application in C# is created using Visual Studio 2017 with name "Ass3".This application contains a form with name "Form1.cs".Below are the files associated with form1.

1.Form1.cs[Design]

2.Form1.cs

//namespace
using System;
using System.Drawing;
using System.Windows.Forms;
//application namespace
namespace Ass3
{
public partial class Form1 : Form
{
int secreteNumber = 0;//variable to store secreteNumber
public Form1()
{
InitializeComponent();
}
//secrete button click
private void btnSecrete_Click(object sender, EventArgs e)
{
lblError.Text = "";//clear label
lblHint.Text = "";//clear label
this.Text = "Form1";//set form title
//creating object of Random class
Random random = new Random();
//generate secrete number between min and max range
secreteNumber = random.Next(int.Parse(txtMinRange.Text), int.Parse(txtMaxRange.Text));
}
//Guess Button click
private void btnGuess_Click(object sender, EventArgs e)
{

lblError.Text = "";//clear label
lblHint.Text = "";//clear label
//taking guess entered by user
int guess = int.Parse(txtGuess.Text);
//checking guess
if (guess < int.Parse(txtMinRange.Text) || guess> int.Parse(txtMaxRange.Text))
{
//if guess is not in the range
lblError.Text= "You must enter a number between "+ txtMinRange.Text + " and "+txtMaxRange.Text+"!";
lblError.ForeColor = Color.Red;//set label color
}
else
{
//checking guess with secrete Number
if(guess> secreteNumber)
{
//if guess is greater than secreteNumber then display message
lblHint.Text = "Higher...";
lblHint.ForeColor = Color.Blue;//set color
}
else if (guess < secreteNumber)
{
//if guess is less than secreteNumber then display message
lblHint.Text = "Lower...";
lblHint.ForeColor = Color.Blue;//set color
}
else if (guess == secreteNumber)
{
//if guess is equal to secreteNumber then display message
lblHint.Text = "You win!";
lblHint.ForeColor = Color.Blue;//set color
//set form title to
this.Text = "----End of Game----";
}
}
}
}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :

Screen 2:Screen when guess is not in the range

Screen 3:Screen when guess is higher than secrete number

Screen 4:Screen when guess is lower than secrete number

Screen 5:Screen when guess is equal to secrete number

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

Submit a c++ file: 2. Write a program that defines the named constant PI, const double...
Submit a c++ file: 2. Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of p. The program should use PI and the functions listed in Table 6-1 to accomplish the following: a. Output the value of Pi Output the value of Pi. b. Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs the following: i.   The...
using C thank you Must submit as MS Word file with a screenshot of the 3...
using C thank you Must submit as MS Word file with a screenshot of the 3 outputs. Run your program 3 times. the output must be in a screenshot not typed for the each time you run the program. thank you Modify the code below to implement the program that will sum up 1000 numbers using 5 threads. 1st thread will sum up numbers from 1-200 2nd thread will sum up numbers from 201 - 400 ... 5th thread will...
Write a Python script that performs brute force to extract a password protected zip file named...
Write a Python script that performs brute force to extract a password protected zip file named sec2.zip. The password is believed to be associated with one of the dictionary word in the 'wordlist.txt file. a) Paste your code here b) What is the password?
Create one Excel file to submit named "Exam 3 Team X.xlsx" where X is your team...
Create one Excel file to submit named "Exam 3 Team X.xlsx" where X is your team letter. Show work for credit. USE EXCEL 1. Use the data below. Team C Date DOW 10YTREAS 8-Apr-20 23,719.37 0.729 1-Apr-20 22,653.86 0.736 25-Mar-20 21,917.16 0.698 18-Mar-20 20,704.91 0.816 11-Mar-20 21,237.38 0.997 4-Mar-20 25,018.16 0.748 26-Feb-20 25,917.41 1.01 19-Feb-20 27,081.36 1.33 12-Feb-20 29,232.19 1.556 5-Feb-20 29,276.34 1.59 29-Jan-20 28,807.63 1.603 22-Jan-20 28,722.85 1.641 15-Jan-20 29,196.04 1.769 8-Jan-20 28,939.67 1.818 1-Jan-20 28,583.68 1.827 a. Create...
Create a CodeBlocks project with a main.cpp file. Submit the main.cpp file in Canvas. C++ Language...
Create a CodeBlocks project with a main.cpp file. Submit the main.cpp file in Canvas. C++ Language A Game store sells many types of gaming consoles. The console brands are Xbox, Nintendo, PlayStation. A console can have either 16 or 8 gigabytes of memory. Use can choose the shipping method as either Regular (Cost it $5) or Expedite (Cost is $10) The price list is given as follows: Memory size/Brand Xbox Nintendo PlayStation 16 gigabytes 499.99 469.99 409.99 8 gigabytes 419.99...
Name your functions countOnesLoop() and countOnesWhere() and submit your code in a file named countOnes.py. Write...
Name your functions countOnesLoop() and countOnesWhere() and submit your code in a file named countOnes.py. Write a function that consists of a set of loops that run through an array and count the number of ones in it. Do the same thing using the where() function (use info(where) to find out how to use it) (in python)
Write a C++ program to create a text file. Your file should contain the following text:...
Write a C++ program to create a text file. Your file should contain the following text: Batch files are text files created by programmer. The file is written in notepad. Creating a text file and writing to it by using fstream: to write to a file, you need to open thew file as write mode. To do so, include a header filr to your program. Create an object of type fsrteam. Open the file as write mode. Reading from a...
Please use C language to code all of the problems below. Please submit a .c file...
Please use C language to code all of the problems below. Please submit a .c file for each of the solutions, that includes the required functions, tests you wrote to check your code and a main function to run the code. Q2. Implement the quick-sort algorithm.
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an empty main function, then add statements in main() to accomplish each of the tasks listed below. Some of the tasks will only require a single C++ statement, others will require more than one. For each step, include a comment in your program indicating which step you are completing in the following statement(s). The easiest way to do this is copy and paste the below...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an empty main function, then add statements in main() to accomplish each of the tasks listed below. Some of the tasks will only require a single C++ statement, others will require more than one. For each step, include a comment in your program indicating which step you are completing in the following statement(s). The easiest way to do this is copy and paste the below...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT