Starting Out with Programming Logic and Design (4th Edition)
Starting Out with Programming Logic and Design (4th Edition)
4th Edition
ISBN: 9780133985078
Author: Tony 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
Use String methods to divide the given email into separate parts. The email will always be in this format: firstName_lastName@domain.com Pull apart and print the first name, last name, and domain. When printing the values all three should be in proper capitalization format - The first letter of each word is uppercase and the rest are lowercase.
b) Print the given string 8 times along with line number.Print line number first and then the given string. Line number goes from 1-8.  String: "Learning Swift."  WAP in Swift programming language.
Python Program to Remove Punctuations From a String.

Chapter 12 Solutions

Starting Out with Programming Logic and Design (4th Edition)

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