Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please implement the following following the instructions using C# in visual studio Instructions: For this activit Application that contains y, you will create a Word

Please implement the following following the instructions using C# in visual studio image text in transcribed
Instructions: For this activit Application that contains y, you will create a Word Occurrence Calculator. Create a Windows Forms a multi-line TextBox control (Input), a Button control (Calculate), and Label control (Result). Your application will allow the user to enter text into the multi-line TextBox, and will calculate the number of occurrences of each unique word i Each Result label. n the TextBox. unique word along with its number of occurrences will be displayed on a single line in the 1. Create a new Windows Forms Application 2. A dd a class to your project named "WordOccurrence", with the following properties: Word (string) Count (integer) 3. Add a class named "WordCalculator" to your project. Add the following static method to your WordCalculator class: CalculateOccurrences: This method will take a list of strings as input, and will return a list of "WordOccurrence" items. If passed a null or empty list as input, it will throw a new exception with the message "Invalid input" 4. In your main form add the following controls: - A multi-line Input TextBox - A Calculate Button -A Result Label - Implement a handler for the button click event, that will take the text in textbox, split it into a list of words, and pass it to WordCalculator, then display the result list of the WordOccurrence list in the label. Each WordOccurrence item will be on a separate line. 5. Using what you learned in this module about unit testing: Create a new test project (class library) that will test your WordCalculator class -Add NUnit to your test project using NuGet package management -Create a new test class, decorate it with the TestFixture attribute - Add 2 tests: CalculateOccurrencesTest: this will pass a defined list of words (you define it), and will assert that the returned result is correct. CalculateOccurrencesShouldThrowException: this test will pass null to the method and will assert that this method will throw an exception (refer to NUnit documentation on how to assert for exceptions: https://sithub.comunit/docs/wiki/Assert Throws) o o Note: making use of C#'s Hashtable class will make things easier for you. Read up on Hashtables: Instructions: For this activit Application that contains y, you will create a Word Occurrence Calculator. Create a Windows Forms a multi-line TextBox control (Input), a Button control (Calculate), and Label control (Result). Your application will allow the user to enter text into the multi-line TextBox, and will calculate the number of occurrences of each unique word i Each Result label. n the TextBox. unique word along with its number of occurrences will be displayed on a single line in the 1. Create a new Windows Forms Application 2. A dd a class to your project named "WordOccurrence", with the following properties: Word (string) Count (integer) 3. Add a class named "WordCalculator" to your project. Add the following static method to your WordCalculator class: CalculateOccurrences: This method will take a list of strings as input, and will return a list of "WordOccurrence" items. If passed a null or empty list as input, it will throw a new exception with the message "Invalid input" 4. In your main form add the following controls: - A multi-line Input TextBox - A Calculate Button -A Result Label - Implement a handler for the button click event, that will take the text in textbox, split it into a list of words, and pass it to WordCalculator, then display the result list of the WordOccurrence list in the label. Each WordOccurrence item will be on a separate line. 5. Using what you learned in this module about unit testing: Create a new test project (class library) that will test your WordCalculator class -Add NUnit to your test project using NuGet package management -Create a new test class, decorate it with the TestFixture attribute - Add 2 tests: CalculateOccurrencesTest: this will pass a defined list of words (you define it), and will assert that the returned result is correct. CalculateOccurrencesShouldThrowException: this test will pass null to the method and will assert that this method will throw an exception (refer to NUnit documentation on how to assert for exceptions: https://sithub.comunit/docs/wiki/Assert Throws) o o Note: making use of C#'s Hashtable class will make things easier for you. Read up on Hashtables

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

Describe recruitment and selection for international operations.

Answered: 1 week ago

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago