Question

In: Computer Science

The user enters some text into a textbox. It can contain any characters (letters, digits, spaces,...

The user enters some text into a textbox. It can contain any characters (letters, digits, spaces, punctuation marks, and there is no length limit). When a button Count is hit , display the number of upper-case letters in the inputted phrase. This must be done in visual studios using C#.

Solutions

Expert Solution

Program:

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 CountUpperCaseDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnCount_Click(object sender, EventArgs e)
{
string inputText;
int count = 0;
//Storing TextBox(txtInput) value into the string
inputText = txtInput.Text;
//checking each every characters of the string to get the count
for (int i = 0; i < inputText.Length; i++)
{
//checking the upper case letters
if (inputText[i] >= 'A' && inputText[i] <= 'Z')
{
count++;
}
}
//displaying the number of upper-case letters in the inputted phrase
MessageBox.Show("The number of upper-case letters in the inputted phrase: "+count);
}
}
}

Output:


Related Solutions

Problem 3Consider the following definitions for sets of characters:•Digits ={0,1,2,3,4,5,6,7,8,9}•Letters ={a, b, c, d, e, f,...
Problem 3Consider the following definitions for sets of characters:•Digits ={0,1,2,3,4,5,6,7,8,9}•Letters ={a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}•Special characters ={∗,&,$,#}Compute the number of passwords that satisfy the given constraints .(i) Strings of length 7. Characters can be special characters, digits, or letters ,with no repeated characters .(ii) Strings of length 6. Characters can be special characters, digits, or letters ,with no repeated...
Implement Lexer(Scanner) that scans the whole source code entered by the user that includes Alphabets(characters), integers(digits),...
Implement Lexer(Scanner) that scans the whole source code entered by the user that includes Alphabets(characters), integers(digits), operators(arithmatic, logical and relational operators), and special symbols. output should be in the form of Symbol table that shows each token with its name, type and number of times entered(lexexmes). dictionary should be implemented in the code by writing RegX for each category. code entered from internet will be discarded. Implementation language will be of your own choice. I really need the answer of...
Directions: Use a CPT manual to obtain codes. Do not leave any blank spaces and all letters must be capitalized.
Directions: Use a CPT manual to obtain codes. Do not leave any blank spaces and all letters must be capitalized.a. Circumcision using a clamp with regional dorsal penile block      b. Office visit for an established patient requiring a detailed history, expanded problem-focused examination, and low-complexity medical decision making      c. Anesthesia for a healthy, 10-month-old male patient having blepharoplasty (code only the anesthesia service—two codes are required)      d. X-ray of the shoulder, 1 view      e. Replacement during follow-up care of cast application of the left...
(a) How many passwords can you make with 8 characters using Uppercase, Lowercase, digits using at...
(a) How many passwords can you make with 8 characters using Uppercase, Lowercase, digits using at least one Uppercase, at least one Lowercase and at least one digit? (b) How many numbers between 1 and 1,000,000 (inclusive) are divisible by at least one of 3,4 and 5? (c) How many numbers between 1 and 1,000,000 (inclusive) are divisible by at least one of 12, 14, 15?
Tine is Gabon is 8 hours ahead of Vancouver. Given any local date a user enters...
Tine is Gabon is 8 hours ahead of Vancouver. Given any local date a user enters in one cell, and local time in another cell, have your spreadsheet determine the date/time in Gabon in the format below. For example, if the user enters 11/1/20 in once cell, 6 PM in another cell, the formula result should display November 2, 2020 2:00 AM. The formula should not display data is no date and/or time is entered.
Write the RE for identifiers that can consist of any sequence of letters (l) or digit...
Write the RE for identifiers that can consist of any sequence of letters (l) or digit (d) or "_" but the first char must be a letter and the last char cannot be a "_" (10)
Write the RE for identifiers that can consist of any sequence of letters (l) or digit...
Write the RE for identifiers that can consist of any sequence of letters (l) or digit (d) or "_" but the first char must be a letter and the last char cannot be a "_"
Write a java program to accept a telephone number with any number of letters. The output should display a hyphen after first 3 digits and subsequently a hyphen (-) after very four digits.
Write a java program to accept a telephone number with any number of letters. The output should display a hyphen after first 3 digits and subsequently a hyphen (-) after very four digits. Also, modify the program to process as many telephone numbers as the user wantscode optimization: no unnecessary variables , if statements and counterssample output screen shown with 3 cases(atleast one with blank spaces ect.)Descriptive block and inline comments include.
Can you think of any television shows or movies in which characters with a severe psychological...
Can you think of any television shows or movies in which characters with a severe psychological disorder were shown in a sympathetic light? If so, are such depictions more or less common than depictions of people with a mental illness as dangerous or violent?
In Excel, What are some of the functions that can be used to manipulate text?
In Excel, What are some of the functions that can be used to manipulate text?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT