Related questions
Problem Statement:
- Design a
program that asks the user to enter a string - The string will then be displayed back to the user
- This is followed by determining the number of
- alphabetic characters
- numeric characters
- lower_case letters
- upper_case letters
- whitespace characters
- and then displaying them
- The user should be given additional chances to enter additional strings
- and each time a string is entered, the above process is to be performed
- The inputting is to stop, when the user enters "end" as the input string
- At that point, total number of
-
- alphabetic characters
- numeric characters
- lower_case letters
- upper_case letters
- whitespace characters
- are to be displayed and the program terminated
-
An
1. Prompt the user to enter a string at the keyboard
2. As long as the string is not "end"
2.1 Display the string, along with an appropriate message
2.2 Examine the current character of the string
2.2.1 If it's alphabetic, update the alphabetic_counter and the total_alphabetic_counter
2.2.2 If it's numeric, update the numeric _counter and the total_numeric_counter
2.2.3 If it's a lower_case letter, update the lower_case _counter and the
total_lower_case_counter
2.2.4 If it's a upper_case letter, update the upper_case _counter and the
total_upper_case_counter
2.2.5 If it's a whitespace character, update the whitespace _counter and the
total_whitespace_counter
2.2.6 Continue from step 2.2 with the next character until done with this string
2.3 Display the alphabetic_counter, numeric _counter, lower_case _counter,
upper_case _counter, and whitespace _counter, each on a separate line,
and each along with an appropriate message
2.4 Prompt the user to enter another string at the keyboard
3. Display the total_alphabetic_counter, total_ numeric _counter,
total_lower_case _counter, total_ upper_case _counter, and total_ whitespace _counter,
each on a separate line, and each along with an appropriate message
4. Stop
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- 1. strcmp( str1, str2 ); returns the value 0 if str1 and str2 are equal. a. true b. false 2. The strlen function returns the _________. a. number of characters in a string, including the null terminator b. number of characters in a string, not including the null terminatorarrow_forward// MovieGuide.cpp - This program allows each theater patron to enter a value from 0 to 4 // indicating the number of stars that the patron awards to the Guide's featured movie of the // week. The program executes continuously until the theater manager enters a negative number to // quit. At the end of the program, the average star rating for the movie is displayed. #include <iostream> #include <string> using namespace std; int main() { // Declare and initialize variables. double numStars; // star rating. double averageStars; // average star rating. double totalStars = 0; // total of star ratings. int numPatrons = 0; // keep track of number of patrons // This is the work done in the housekeeping() function // Get input. cout << "Enter rating for featured movie: "; cin >> numStars; // This is the work done in the detailLoop() function // Write while loop here //...arrow_forwardTrue or False All variables have a ToString method that you can call to convert the variable’s value to a string.arrow_forward
- To concatenate or combine two strings, you can use the ____ operator.arrow_forwardUsing a for Loop Summary In this lab the completed program should print the numbers O through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter- controlled while loop. Instructions 1. Write a for loop that uses the loop control variable to take on the values O through 10. 2. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. 3. Execute the program by clicking the Run button at the bottom of the screen. Is the output the same?arrow_forwardLab Activity for the students: Exercise 5: Write a program that asks the user to input a letter. The program finds and prints if the letter is uppercase or lowercase. Then, the program asks the user to input a string and get a three-character substring from the beginning of the string. (1 Mark ) Example : If the inputs are 'y' and "Community". Then, the program will print: y is lowercase The substring is: Comarrow_forward
- Code_Program to check if strings are rotations of each other or not? Approach Create a temp string and store concatenation of str1 to str1 in temp. temp = str1.str1 If str2 is a substring of temp then str1 and str2 are rotations of each other. Example:str1 = "ABACD" str2 = "CDABA".arrow_forwardPYTHON QUESTION Use f-strings and psuedocode program2_1.pyWrite a program that calculates weekly pay, disregarding overtime. Assign an hourly pay rate of 27.50 to a properly named constant (see page 80). Prompt the user to enter the weekly hours worked. The hours might not be an integer. Calculate the weekly pay and display it as currency using an f-string. Currency format means two decimal places and a comma for pay in excess of 1,000ドル.00.arrow_forward✓ Allowed languages с Problem Statement Create a program that will print (in order they appear in the string) all unique characters in a string (excluding spaces) Input Input starts with a number N and is followed by N strings Output Print all unique characters in the string. Limits 1 <= N <= 20 Notes Problems will have test cases that are not listed in their specification. Your solution must produce the right output for these hidden test cases. Sample Input #1 4 Harrenhal Drogos Thoros of Myr Iron Born Sample Output #1 Harenl Drogs Thors fMy IronB Copy Copyarrow_forward
- C PROGRAMarrow_forwardCode_Program to check if strings are rotations of each other or not? Approach Create a temp string and store concatenation of str1 to str1 in temp. temp = str1.str1 If str2 is a substring of temp then str1 and str2 are rotations of each other. Example:str1 = "ABACD" str2 = "CDABA".arrow_forwardAn integer n is passed as argument to a function named convert0to5. This function returns an integer by replacing all 0's in the number by 5. Note: Do not convert the number to string.arrow_forward
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education