EBK STARTING OUT WITH VISUAL C#
EBK STARTING OUT WITH VISUAL C#
5th Edition
ISBN: 9780135204818
Author: GADDIS
Publisher: VST
Question
Book Icon
Chapter 8, Problem 3PP
Program Plan Intro

Sentence Capitalizer

Program plan:

Design the form:

  • Place two label box controls on the form, and change its name and properties.
  • Place one text box control on the form, and change its name and properties to get the string from user.
  • Place one command button control on the form, and change its name and properties to display the first character of each sentence is capitalized in label box.

In code window, write the code:

Program.cs:

  • Include the required libraries.
  • Define the namespace “SentenceCap”.
    • Define a class “Program”.
      • Define a constructor for the class.
      • Define required functions to run “Form1”.

Form1.cs:

  • Include the required libraries.
  • Define namespace “SentenceCap”.
    • Define a class “Form1”.
    • In btnCase() method,
      • Call sentenceCase() method to capitalize the first character in each sentence and display it into label box.
    • In sentenceCase() method,
      • Declare the required variables.
      • Check whether “i” is equal to “0”. If yes, call ToUpper() method to convert the first character of each sentence.
      • Otherwise, check the “i” is greater than “2” and checks there are punctuations and whitespace in sentence. If yes, call ToUpper() method to convert the first character of each sentence.
      • Otherwise, simply store the character.
      • Return the capitalized first character in each sentence.
    • Close the application.

Form Design:

View the Form Design in IDE.

EBK STARTING OUT WITH VISUAL C#, Chapter 8, Problem 3PP

Set the Form Control properties in Properties window as follows:

ObjectPropertySetting
Form1TextProgram8_3
label1TextEnter a string:
textBox1Text(Empty)
lblResultText(Empty)
btnCaseText Use sentence case
  • Add two label box controls to the form from Toolbox.
  • Add one text box control to the form from Toolbox.
  • Add one command button control to the form from Toolbox.

Blurred answer
Students have asked these similar questions
Design a dynamic programming algorithm for the Longest Alternating Subsequence problem described below: Input: A sequence of n integers Output: The length of the longest subsequence where the numbers alternate between being larger and smaller than their predecessor The algorithm must take O(n²) time. You must also write and explain the recurrence. Example 1: Input: [3, 5, 4, 1, 3, 6, 5, 7, 3, 4] Output: 8 ([3, 5, 4, 6, 5, 7, 3, 4]) Example 2: Input: [4,7,2,5,8, 3, 8, 0, 4, 7, 8] Output: 8 ([4, 7, 2, 5, 3, 8, 0,4]) (Take your time with this for the subproblem for this one)
Design a dynamic programming algorithm for the Coin-change problem described below: Input: An amount of money C and a set of n possible coin values with an unlimited supply of each kind of coin. Output: The smallest number of coins that add up to C exactly, or output that no such set exists. The algorithm must take O(n C) time. You must also write and explain the recurrence. Example 1: Input: C24, Coin values = = [1, 5, 10, 25, 50] Output: 6 (since 24 = 10+ 10+1+1 +1 + 1) Example 2: Input: C = 86, Coin values = [1, 5, 6, 23, 35, 46, 50] Output: 2 (since 86 = 46+35+5)
Design a dynamic programming algorithm for the Longest Common Subsequence problem de- scribed below Input: Two strings x = x1x2 xm and y = Y1Y2... Yn Output: The length of the longest subsequence that is common to both x and y. . The algorithm must take O(m n) time. You must also write and explain the recurrence. (I want the largest k such that there are 1 ≤ i₁ < ... < ik ≤ m and 1 ≤ j₁ < ... < jk ≤ n such that Xi₁ Xi2 Xik = Yj1Yj2 ··· Yjk) Example 1: Input: x = 'abcdefghijklmnopqrst' and y = 'ygrhnodsh ftw' Output: 6 ('ghnost' is the longest common subsequence to both strings) Example 2: Input: x = 'ahshku' and y = ‘asu' Output: 3 ('asu' is the longest common subsequence to both strings)
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education