1. a. Correct the following code so that it generates 50 random integers in the range of 30 up to and including 110 and stores the numbers in array r. Correct all errors. Int (]r= new int(49]; for (int i=0; kr.length+1;1+{ ri) = 10+Math.randomo*100; b. The following code checks if two characters next to each other in a String str are the same. If a match is found, It prints a message as shown below. Find all errors and correct them so the output for the String str in the example is 7 has a match I has a match String str = "ghu7763459823||"; for (int l=1; Ie=str.length()-1; -) { If (str.charAt(l-1) = str.charAt(1)) System.out.printin(str.charAt(i-1)+" has a match");
1. a. Correct the following code so that it generates 50 random integers in the range of 30 up to and including 110 and stores the numbers in array r. Correct all errors. Int (]r= new int(49]; for (int i=0; kr.length+1;1+{ ri) = 10+Math.randomo*100; b. The following code checks if two characters next to each other in a String str are the same. If a match is found, It prints a message as shown below. Find all errors and correct them so the output for the String str in the example is 7 has a match I has a match String str = "ghu7763459823||"; for (int l=1; Ie=str.length()-1; -) { If (str.charAt(l-1) = str.charAt(1)) System.out.printin(str.charAt(i-1)+" has a match");
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 20RQ
Related questions
Question
100%
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage