STARTING OUT W/PROGRAM.LOGIC...-TEXT
STARTING OUT W/PROGRAM.LOGIC...-TEXT
5th Edition
ISBN: 2810022369454
Author: GADDIS
Publisher: PEARSON
Question
Book Icon
Chapter 12, Problem 2AW
Program Plan Intro

Character testing library functions:

  • Library functions other than the string library functions are provided by programming language, which are intended to work with single characters.
  • The support library functions are used for testing the value of the character.
  • The function will return the Boolean result on testing; the result will be in “True” or “False” format.

isUpper(character):

  • This function is used to validate whether the character given is upper case letter.
    • The function will return “True” if the character is in upper case.
    • The function will return “False” if the character is in lower case.

isLower(character):

  • This function is used to validate whether the character given is lower case letter.
    • The function will return “True” if the character is in lower case.
    • The function will return “False” if the character is in upper case.

Example:

The below algorithm determines whether the first character in the string is in lower case and the present is in lower case, the character gets replaced by “0”.

//determine if the first character is in lower case

If isLower(str[0]) Then

//replace the values present at the first position

Set str [0] = "0"

//end if

End If

Explanation:

  • If condition validates the first position of the “str” is in lower case or not.
  • If the condition becomes true, the character at positon “0” gets replaced with the character “0”.

Algorithm:

  • Declare and define a string variable “str”.
  • Declare and define the required variables for storing index and count of lower case letters.
  • Loop that iterates for the entire string.
  • Condition to validate whether the given string contains lower case.
  • On true add the lower case character count by 1.
  • Display the count.

Blurred answer
Students have asked these similar questions
Design an algorithm or function to find the longest substring which contains 2 unique characters in a given string. You may list steps or psuedo code. Example: In the string "abaacacaacda" return "aacacaac"
The____ function returns the length of a string .
This string method returns true if a string contains only alphabetic characters and is at least one character in length.a. the isalpha methodb. the alpha methodc. the alphabetic methodd. the isletters method

Chapter 12 Solutions

STARTING OUT W/PROGRAM.LOGIC...-TEXT

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT