STARTING OUT W/PROGRAM.LOGIC...-TEXT
5th Edition
ISBN: 2810022369454
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 5SA
Program Plan Intro
Inserting or deleting characters in a string:
- Library function or modules are provided by the
programming languages to perform insert and deletion operations.
Inserting:
The pseudocode library modules that are used to insert the values is :
insert (string1,position,string2)
- The above function will insert the “string 2” to the “string1” at the “position” specified.
- “string1” and “string2” is string
- “Position” is an integer.
Deleting:
The pseudocode library modules that are used to insert the values is
delete (string1,start,end)
- The above function will delete the strings that are specified from the start to the end.
- “Start” and “End” is integer that specifies the beginning position and end position.
- “String” is string.
Example:
The below statement is used to delete the first three characters from the string “city”.
//deletes first three character in city
delete (city, 0, 2)
Explanation:
- The above function will delete the strings present in the “city” variable that is specified from the position “0” to the position “2”.
- The above function will delete the first three character of the “city” string.
- On execution, the “city” will hold “ton” as its value.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
= "welcome everybody"
Dim str As String
Dim str2 As String
For i
str2 &= str.Chars(i) & str.Substring(i, 3).StartsWith("e")
str.Length
3 To 3 Step -4
%3D
Next
MsgBox(str2)
oFalseeTruee True
dfalserfalse false
ofalseefalseetrue
none
IN C LANGUAGE CODE:Write a code snippet that can arrange the alphabets of a name entered by user in alternate cases.Note: Ignore white spaces.
Input String:Timothy Olyphant
Output String :TiMoThY OLyPhAnT
Input String: Olga Kurylenko
Output string: OlGa KuRyLeNkO
Option #1: String Values in Reverse Order
Assignment Instructions
Write a Python function that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse order. The function is to be called from the main method.
In the main method, prompt the user for the three strings.
Chapter 12 Solutions
STARTING OUT W/PROGRAM.LOGIC...-TEXT
Ch. 12.2 - Prob. 12.1CPCh. 12.2 - Prob. 12.2CPCh. 12.2 - Design an algorithm that determines whether the...Ch. 12.2 - Design an algorithm that determines whether the...Ch. 12.2 - Prob. 12.5CPCh. 12.2 - Prob. 12.6CPCh. 12 - Prob. 1MCCh. 12 - Prob. 2MCCh. 12 - If the str variable contains the string "berry",...Ch. 12 - If the str variable contains the string "Redmond",...
Ch. 12 - Prob. 5MCCh. 12 - Prob. 1TFCh. 12 - Prob. 2TFCh. 12 - If the String variable str contains the string...Ch. 12 - The insert library module automatically expands...Ch. 12 - Prob. 5TFCh. 12 - Prob. 6TFCh. 12 - Prob. 7TFCh. 12 - Prob. 1SACh. 12 - If the following pseudocode were an actual...Ch. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 - Prob. 5SACh. 12 - Design an algorithm that counts the number of...Ch. 12 - Prob. 2AWCh. 12 - Design an algorithm that counts the number of...Ch. 12 - Design an algorithm that deletes the first and...Ch. 12 - Design an algorithm that converts each occurrence...Ch. 12 - Design an algorithm that replaces each occurrence...Ch. 12 - Assume the following declaration exists in a...Ch. 12 - Prob. 1DECh. 12 - Prob. 2DECh. 12 - Prob. 3DECh. 12 - Prob. 1PECh. 12 - Sentence Capitalizer Design a program that prompts...Ch. 12 - Prob. 3PECh. 12 - Sum of Digits in a String Design a program that...Ch. 12 - Prob. 5PECh. 12 - Alphabetic Telephone Number Translator Many...Ch. 12 - Word Separator Design a program that accepts as...Ch. 12 - Pig Latin Design a program that reads a sentence...Ch. 12 - Prob. 9PECh. 12 - File Encryption File encryption is the science of...Ch. 12 - File Decryption Filter Design a program that...Ch. 12 - Password Weakness Detector Design a program that...
Knowledge Booster
Similar questions
- A structure that allows repeated execution of a block of statements is a(n) _____________. sequence selection array looparrow_forwardPython Language: Word Sleuth Programarrow_forwardModule main() // Local variables Constant Integer SIZE = 7 Declare Integer index, numbers[SIZE] // Get random numbers For index = 0 to SIZE - 1 Set numbers[index] = random(0, 9) End For // display numbers For index = 0 to SIZE - 1 Display “Random number “, index + 1, “ is: “,numbers[index] End For End Module Flowchart pleasearrow_forward
- Palindrome Checkercreate a JavaScript program that checks if phrasesentered by the user are palindromes. A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as “SIR”,“raceBIKE”, “Never odd or even”, “20/1/20”. The program should prompt the user to typein a phrase that is at least three characters long, and then tell the user whether the phrasewas a palindrome. Note, the decision should be based solely on letters and numericaldigits, and so it should not consider other characters, such as spaces or exclamationmarks, even though these might be entered by the user. when checking palindromes.A. Select your test data with care. Both palindromes and non-palindromes would be included in this. Provide examples that are text, numeric, and mixed; ignore any additional characters and spaces; andB. Ask the user for the word and then read their input. To verify that their input string has been read correctly, test this by displaying…arrow_forwardJAVA:arrow_forwardDirections: Code in Python and Code in Java/C++arrow_forward
- # subprogram: PrintInt# author: Charles W. Kann# purpose: To print a string to the console# input: $a0 - The address of the string to print.# $a1 - The value of the int to print# returns: None# side effects: The String is printed followed by the integervalue..textPrintInt: # Print string. The string address is already in $a0 li $v0, 4 syscall # Print integer. The integer value is in $a1, and must # be first moved to $a0. move $a0, $a1 li $v0, 1 syscall # Print a new line character jal PrintNewLine #return jr $raWhen the program is run, it never ends and acts like it is stuck in an infinite loop. Helpthis colleague figure out what is wrong with the program.a. Explain what is happening in the programb. Come up with a mechanism which shows that this program is indeed in an infiniteloop.c. Come up with a solution which fixes this problem.arrow_forward# subprogram: PrintInt# author: Charles W. Kann# purpose: To print a string to the console# input: $a0 - The address of the string to print.# $a1 - The value of the int to print# returns: None# side effects: The String is printed followed by the integervalue..textPrintInt: # Print string. The string address is already in $a0 li $v0, 4 syscall # Print integer. The integer value is in $a1, and must # be first moved to $a0. move $a0, $a1 li $v0, 1 syscall # Print a new line character jal PrintNewLine #return jr $raWhen the program is run, it never ends and acts like it is stuck in an infinite loop. Helpthis colleague figure out what is wrong with the program.a. Explain what is happening in the programb. Come up with a mechanism which shows that this program is indeed in an infiniteloop.c. Come up with a solution which fixes this problem. need accurate ans otherwise you will get downvote # subprogram: PrintInt# author: Charles W. Kann# purpose: To print a string to the console# input:…arrow_forward# subprogram: PrintInt# author: Charles W. Kann# purpose: To print a string to the console# input: $a0 - The address of the string to print.# $a1 - The value of the int to print# returns: None# side effects: The String is printed followed by the integervalue..textPrintInt: # Print string. The string address is already in $a0 li $v0, 4 syscall # Print integer. The integer value is in $a1, and must # be first moved to $a0. move $a0, $a1 li $v0, 1 syscall # Print a new line character jal PrintNewLine #return jr $raWhen the program is run, it never ends and acts like it is stuck in an infinite loop. Helpthis colleague figure out what is wrong with the program.a. Explain what is happening in the programb. Come up with a mechanism which shows that this program is indeed in an infiniteloop.c. Come up with a solution which fixes this problem. need accurate ans otherwise you will get downvotearrow_forward
- write programs date formarrow_forwardpython please explainarrow_forwardPython: VOWEL OR CONSONANT Challange Ask the user to input a word. The program will then tell them how many letters are in the inputted word. It will also tell them how many vowels and consonants are in the word. It will then ask which number (between 1- the length of their word - DO NOT USE THE PLACEHOLDER ZERO) that they would like to pick. It will then tell them whether that letter is a vowel or consonant. Next the program will pick a random letter from the word that was inputted, print that letter and tell the user whether it is a vowel or consonant: OUTPUT: What is your word?: Larry There are 5 letters in Larry. There are 1 vowel and 4 consonants For your word, L is "1" and Y is "5" Which letter do you want 1-5? 4 The letter you picked is an "r" and that letter is a CONSONANT and there are two of them I picked a random letter from your word, it is "a" The letter I randomly picked is a VOWEL Remember : vowels are "a, e, i, o, u" a "y",should output as "…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning