Checkout
checkout
view
Your Cart Your Cart: item(s)
Subjects -> Computer Science -> Other -> Posting #49275
Add to Shopping Cart
$2.19 Instant Download
Computer Science, Other
Year 3

Components and Classes


Create a Class Library project that will count the number of characters, words, sentences, and paragraphs contained in a text file or a multi-line text box. You will also create a Windows Application to test the Class Library project you create. The Class Library project will have one class module. The class will have one method that will open a text file for input. The same method should also count the number of characters, words, sentences, and paragraphs in the file. Another method will perform the same task but use a multi-line text box. The developer should be able to read these values using read-only properties. The form will have an OpenFileDialog control instance to open a file as specified by the user. The Figure shows the completed form.

• Save and execute the file named Ch12Ex1.exe, (You will also need the file: Ch12Ex1ClassLibarary.dll) setting the drive designator as necessary. Click the Analyze File button. When the Open dialog box appears, select the name of a text file on your computer. Click Open. The number of characters, words, sentences, and paragraphs contained in the text file will appear on the form. Exit the solution.

• Start VB .NET, and then create a new Windows Application project.

• Add a Class Library project to the solution. Note that VB .NET will create an empty class mod- tile. Name the Class Library project Unit5ClassLibrary.

• Set the name of the class automatically created by VB .NET to StringProcessor.
• Set the root namespace to Course.

• In the Windows Application project add a reference to the Class Library project.
• In the class module, declare hidden variables to store the number of characters, words, sentences, and paragraphs.

• Create four read-only properties named Characters, Words, Sentences, and Paragraphs. These properties should return the number of characters, words, sentences, and paragraphs, respectively, stored in the corresponding hidden variables. Create Property Procedures rather than Public variables.

• Create a read-write property named StringContents, and a hidden variable to store the string. If the developer sets the property, calculate the number of characters, words, sentences, and paragraphs contained in the string, and then store the results in the hidden variables that you declared. Note: A word is a sequence of characters separated by a space. A sentence is terminated with a period, and a paragraph ends with a LineFeed character (Microsoft.VisualBasic.ControlChars.Lf). Your solution does not need to account for malformed sentences. For example, a paragraph that ends in something other than a sentence with a period.

• In the class module, create a method named OpenFile. This method should accept one argument - the full path name of the file to be opened. In the OpenFile method, write the necessary statements to open the text file, then count the number of characters, words, sentences, and paragraphs. As you will he reading a disk file, you will need to rise the StreamReader class to open and read the file.

• The process of determining what constitutes a word can be expanded. For example, in addition to having a space character separate a word, tab characters should also separate words. Add this feature to the OpenFile method and the StringContents property procedure.

• Create the control instances on the form as shown in the Figure.
• Write the code for the Analyze Text button. The code in this event handler should create an instance of the StringProcessor class. Set the StringContents property to the contents of the multiline text box. Assigning a value to the property causes the code you wrote in the Property Procedure to process the string, and set the values of the read-only properties. Store the value of the Characters, Words, Sentences, and Paragraphs properties in the output labels appearing on the form.

• Write the code for the Analyze File button. Use the OpenFileDialog control instance to get a file name from the user. Create an instance of the StringProcessor class. Call the OpenFile method to process the file. Finally, display the results from the read-only properties in the labels on the form.

Attachments
Ch12Ex1.exe  View File
Ch12Ex1ClassLibarary.dll  View File
u5-wordcount.jpg  View File

By OTA:  Rajender Kumar, MCom

OTA Rating:  4.8/5

Your Price:  $2.19  (original value ~$31.92)

What's included:

  • Plain text response
  • Attachment(s):
    • open file.zip
    • unit 5 classl library.zip
$2.19 Download Add to Cart

Add to Shopping Cart
$2.19 Instant Download
Project charter - TopLiance Corporation sells home appliances. They have over 50 sales agents across multiple states. They have decided to implement an online sales program. The new Internet based sales program is expected to increase the sales volume and enhance the profit margin. You are asked to head the project team and you are expected to generate the following: 1. A Project Charter (...
Capability Maturity Model (CMM) - 1. Capability Maturity Model (CMM) is intended for process improvement in software development. Propose a project management maturity model based on CMM. Your model must have five levels corresponding to the five CMM levels. The new project management maturity model is intended to improve IT project management processes and systems. For each level in your mode...
Project phases - A project has the following four phases: • Concept • Development • Implementation • Close-out For each phase, identify the communication needs and briefly describe how you will satisfy them. Your answer shall include: Method of communication (informal chat, report, presentation, e-mail, web, etc.) Type of information (what it contains) Its pu...
Please fix minicalc using visual basic.Net - The MiniCalc application was designed to perform basic math calculations: +, -, *, /. However, in its present form, this application needs some improvements. 1. Test all operators with the values 8 and 2 to make sure it works as expected. 2. Test the program with 99999 + 99999. This should raise a 'System.OverflowException' exception. 3. Mod...
cost of a hotel room - Save and execute the file attached. If you have not yet installed the software, single right click on the file and choose save target as, then run the file from your desktop. Set the drive designator as necessary. Enter the values shown, and then click the Calculate button. The cost of the reservation appears in the output section of the form. Exit the solution. • Create...

Page generated in 0.0457 seconds

About Us ·  Contact Us ·  Samples ·  Solutions ·  Legal Terms and Conditions ·  Privacy Policy

©2008 SolutionLibrary.com

Search for Solutions About Us Samples