Explanation of Solution
Given: The following lines of code with a list box:
Dim a As Integer = 4
Dim b As Integer = 2
Dim c As String = "Municipality"
Dim d As String = "pal"
lstBox.Items.Add(c.Length)
lstBox.Items.Add(c.ToUpper)
lstBox.Items.Add(c.Substring(a, b) & c.Substring(5 * b))
lstBox.Items.Add(c.IndexOf(d))
To find: The output of the lines of code that are displayed in the text box or list box.
Dim a As Integer = 4
Dim b As Integer = 2
Dim c As String = "Municipality"
Dim d As String = "pal"
lstBox.Items.Add(c.Length)
lstBox.Items.Add(c.ToUpper)
lstBox.Items.Add(c.Substring(a, b) & c.Substring(5 * b))
lstBox.Items.Add(c.IndexOf(d))
Solution:
In the aforementioned lines of code, the integer type variables, a and b, are declared and initialized to 4 and 2, respectively whereas the string type variables, c and d, are declared and initialized to “Muncipality� and “pal�, respectively...
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Pearson eText for Introduction to Programming Using Visual Basic -- Instant Access (Pearson+)
- A palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number (such as 16461) that remains the same when its digits are reversed. Create a flow chart of palindrome number.arrow_forwardFast pleasearrow_forwardDabugging Exercises 1. What is wrong with the following pseudocode? 11 This program assigns a character to the first element in il a string. Declare String letters Set letters[0] Display "The first letter of the alphabet is ", "A" %3D lettersarrow_forward
- PYTHON PROGRAMMING LANGUAGE Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list). Main Function. Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list. Read Function. The read function should return the contents of the text document as a list. Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name. EXAMPLEPlease enter a name: AdamAdam is found in the list.Enter another name (Y/N): YPlease enter a name: AndrewSorry, Andrew was not found in the list. Would you like to add it? (Y/N): YAndrew has been added to the list.Enter another name (Y/N): N LIST EXAMPLEadambryancharlie Final…arrow_forwardString Manipulation Task 1: String and Lists Warm Store any sentence of your choice in a variable called sentence. Print out the variable called sentence and explain what happened: Now type now out the below code under it, and explain what happened: splitsentence = sentence.split() print(splitsentence) Hot Hints: You will need to use... input() A variable Add to the program so that it asks the user to enter a word that can be found in your sentence. Loop through every word in the sentence which has been For loop split. If, else Whilst looping, If the word the user has entered matches a print() word in the sentence, the program should display “match" otherwise it should display "no match"arrow_forwardLAB ASSIGNMENTS IMPORTANT: you should complete the PDP thinking process for each program. Turn in items: 1) fullname_regex.py - Ask the user to enter the source text to search, such as the name_source variable here: name_source = input('Enter full name in this format - first middle last'). Then, you can adapt the first two code lines from lesson slide 13, to search this new source. Edit the code to match the new situation and change the regex pattern to identify text that could be a full name. Hints: Initially write your regex pattern to check if the user enters three words separated by a space. Then, strive to make the regex adaptable if the person's full name has more than or less than 3 words. Then, think about allowing (not requiring) common characters like a period, hyphen or '. Slides 11-13 should be helpful. 08 For printing, end with a conditional block that provides an appropriate message if there is a match or not. Match Enter your full name: first middle last Betty Lou Who…arrow_forward
- LAB ASSIGNMENTS IMPORTANT: you should complete the PDP thinking process for each program. Turn in items: 1) fullname_regex.py - Ask the user to enter the source text to search, such as the name_source variable here: name_source=input('Enter full name in this format - first middle last'). Then, you can adapt the first two code lines from lesson slide 13, to search this new source. Edit the code to match the new situation and change the regex pattern to identify text that could be a full name. Hints: Initially write your regex pattern to check if the user enters three words separated by a space. Then, strive to make the regex adaptable if the person's full name has more than or less than 3 words. Then, think about allowing!!! (not requiring) common characters like a period, hyphen or '. Slides 11-13 should be helpful. For printing, end with a conditional block that provides an appropriate message if there is a match or not. Match No Match Challenge 1 Enter your full name: first middle…arrow_forwardMoney Counting Algorithm: Write a program that shows how much the 25 cents, 50 cents and 1 TL coins you put on paper are worth using the size and color information. The algorithm is entirely up to you. Explain the algorithm you developed, add code and images. b) Heads and Tails Detection Algorithm: Write the program that shows whether the coin placed on the paper is heads or tails. Developing the algorithm is entirely up to you. This algorithm should work in three currencies. (If you find a suitable code, etc. somewhere, it is a direct copy. Your codes should be in accordance with the lectures. Put explanations about what you are doing).arrow_forwardDetail code only else downvoted. section grouping is a string containing just characters "(" and ")". A standard section succession is a section arrangement that can be changed into a right math articulation by embedding characters "1" and "+" between the first characters of the grouping. For instance, section successions "()()" and "(())" are standard (the subsequent articulations are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not. You are given an integer n. You will likely develop and print precisely n diverse customary section arrangements of length 2n. Input :The primary line contains one integer t (1≤t≤50) — the number of experiments. Each experiment comprises of one line containing one integer n (1≤n≤50). Output :For each experiment, print n lines, each containing an ordinary section grouping of length precisely 2n. All section groupings you output for a testcase ought to appear as something else (however they might rehash in various experiments). In case there…arrow_forward
- Introduction Some number of teams are participating in a race. You are not told how many teams are participating but you do know that: Each team has a name, which is one of the uppercase letters A-Z. No two teams have the same name, so there are a maximum number of 26 teams. Each team has the same number of members. No two runners cross the finish line at the same time – i.e. there are no ties. At the end of the race we can write the results as a string of characters indicating the order in which runners crossed the finish line. For example: ZZAZAA We can see there were two teams: A and Z. Team A’s runners finished in 3rd, 5th and 6th place. Team Z’s runners finished in 1st, 2nd and 4th place. Scoring the race Each runner is assigned a score equal to their finishing place. In the example above team Z’s runners achieved scores of 1, 2 and 4. Team A’s runners scores were 3, 5, and 6 respectively. The team’s score is the sum of the members score divided by the number of people on…arrow_forwardBackward String Design a program that prompts the user to enter a string and then displays the string contents backward. For instance, if the user enters "gravity" the program should display "“ytivarg."arrow_forwardUnit 4 Debugging Exercises The following 2 debugging assignments begins with some comments (lines that begin with 2 slashes) that describes the program. Examine the pseudocode that follows the introductory comments. Discover the errors and fix the pseudocode in the area labeled, Correct the pseudocode below. Pseudocode Debugging Exercise 1 // This pseudocode should create a report that contains an apartment complex rental agent's commission. // The program accepts the ID number and name of the agent who rented the apartment, // and the number of bedrooms in the apartment. // The commission is $100 for renting a three-bedroom apartment, $75 for renting a two-bedroom apartment, // $55 for renting a one-bedroom apartment, and $30 for renting a studio (zero-bedroom) apartment. // Output is the salesperson’s name and ID number and the commission earned on the rental. start Declarations num salesPersonID string salesPersonName num…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,