Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Question 1
a) Use pseudocode to describe an algorithm that counts the number of letters, digits and
special characters in a string. Anything between 'a' or 'A' and 'z' or 'Z' is considered a
letter, anything between 0 and 9 is considered a digit, while anything else is considered a
special character.
Input: a string s read from the keyboard, for example s = '3 beautiful days.'
Output: letter count / = 13, digit count d = 1, special character count c = 3
For solving this task, consider the string to be an array of characters and do not use any
predefined functions that would make this task trivial.
b) Show an implementation of the algorithm designed in the language of your choice. You
will not be penalised for small syntactical errors.
c) Implement an algorithm in the language of choice that counts the occurrence of a digit in a
number recursively.
Input:
a number n read from the keyboard, for example n = 30563323
a digit d the occurrences of which should be counted, for example d = 3
Output: a number c = 4 (i.e., how many of digit d there are in n).
For solving this task, consider the string to be an array of characters. You can use any
predefined functions in the language of your choice, however their name and
number/location of arguments must be accurate.
expand button
Transcribed Image Text:Question 1 a) Use pseudocode to describe an algorithm that counts the number of letters, digits and special characters in a string. Anything between 'a' or 'A' and 'z' or 'Z' is considered a letter, anything between 0 and 9 is considered a digit, while anything else is considered a special character. Input: a string s read from the keyboard, for example s = '3 beautiful days.' Output: letter count / = 13, digit count d = 1, special character count c = 3 For solving this task, consider the string to be an array of characters and do not use any predefined functions that would make this task trivial. b) Show an implementation of the algorithm designed in the language of your choice. You will not be penalised for small syntactical errors. c) Implement an algorithm in the language of choice that counts the occurrence of a digit in a number recursively. Input: a number n read from the keyboard, for example n = 30563323 a digit d the occurrences of which should be counted, for example d = 3 Output: a number c = 4 (i.e., how many of digit d there are in n). For solving this task, consider the string to be an array of characters. You can use any predefined functions in the language of your choice, however their name and number/location of arguments must be accurate.
Expert Solution
Check Mark
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