Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
In main:
- Declare an array capable of holding five Strings.
- Populate the array by entering five first names all on one one line separated by spaces (see sample output but use different names).
- Use a foreach loop (see page 255) to process the array and display the names on one line separated by spaces.
- Pass the array to a void method.
In the void method:
- Sort the array.
- Create an arraylist of Strings.
- Use a loop to populate the arraylist with the Strings in the array that was passed it.
- Insert another name (you choose it) at the start of the arraylist.
- Remove the name at the end of the arraylist.
- Use a foreach loop to process the arraylist and display the names on one one line separated by spaces.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
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.Similar questions
- Create a array of size n and poulate it with random numbers in range @ to 150. Print the average value in the array. Take n as input by user. Write whole code in main function only.Given n>=1 and narrow_forwardReal World Example You work at a car dealership and your boss asks you to get the color of a car. He tells you the parking lot to get it from (the object you're searching) and then writes exactly where it is. row1 [0].color, he could also give you this direction as an array ["row1", "[0]", "color"]. If there is no color he tells you to tell him "no color found" (the default value). You follow his instructions and return "red". Examples = { "a": [{ "b": { "c": 3 } }] } var object get (object, "a[0].b.c") → 3 get (object, ["a", "0", "b", "c"]) -3 get (object, "a.b.c", "default") "default"arrow_forward4. Remove all occurrences of a particular element from an array Consider an array named source. Write a method/function named removeAll( source, size, element) that removes all the occurrences of the given element in the source array. You must execute the method by passing an array, its size and the element to be removed. After calling the method, print the array to show whether all the occurrences of the element have been removed properly. nmm" Use Python Example: source=[10,2,30,2,50,2,2,60,0,0] removeAll(source,8,2) After calling removeAll(source,8,2), all the occurrences of 2 must be removed. Printing the array afterwards should give the output as: [ 10,30,50,60,0,0,0,0,0,0]arrow_forward
- A bit new to methods and need a little bit of help. Swap Method Your task is to write a public static method named swap that takes a single parameter which is an array of doubles. This method should swap the first and last element in the array and then return the adjusted double array. You can assume that all arrays passed into the method are a length of 2 or more. For example, the test data provided when passed into the swap method should go from: {8.34, 7.221, 10.643, 93.2} toarrow_forwardPlease provide a flowchart for this question(pseudocode is acceptable) Finding Missing Number: Given a set of numbers in the range [0, n]. -Only 1 number is missing from the array. -Find the missing number? Note: The number in a set is not sorted Please note: that I am not asking for the actual code for this question but just the flowchartarrow_forwardReal World Example You work at a car dealership and your boss asks you to get the color of a car. He tells you the parking lot to get it from (the object you're searching) and then writes exactly where it is. row1 [0].color, he could also give you this direction as an array ["row1", "[0]", "color"]. If there is no color he tells you to tell him "no color found" (the default value). You follow his instructions and return "red". Examples = { "a": [{ "b": { "c": 3 } }] } var object get (object, "a[0].b.c") → 3 get (object, ["a", "0", "b", "c"]) -3 get (object, "a.b.c", "default") "default"arrow_forward
- Write the program that has the following menu. This menu should continue to come up until the user selects Quit. 1) Add new user info. 2) Print complete report. 3) Print conditional report. 4) Sort the data by Name. 7) Quit (Option 1) If the user Selects option 1) Add new user info the following questions should be asked. After this information has been input the program should go back to the menu. This information should be stored in an array of records. Input Name -> Input Phone Number -> Input Salary-> 25000.00 (Option 2) // Use bubble sort If the user Selects option 2) Print complete report the following output should appear. This is an example report assuming three users were input. Name Phone Number Bob Tim Bob's Number Tim's Number Salary 25000.00 65000.95 (Option 3) If the user Selects option 3) Print conditional report the following question should be asked, followed by the report. This report assumes the same three user from above. Created by Paint S Print user with a salary…arrow_forwardThere may be extra spaces or formatting characters at the start or end of a string when interacting with a string object. Spaces and other characters can be taken out of either end of a string using the Trim and TrimEnd methods. You can provide a character or an array of characters to cut. If you give an array of characters, the string will be cut if any of the characters are found in the array.To remove spaces from the start and end of a group of string values, write a C# programme:arrow_forwardIn c++, Declare a constant “ SIZE = 5 ” Declare an array of ints , of size SIZE . Initializethat array to have the values 10, 12, 15, 19, 6 .– Write a loop that calculates and prints out the minimum value of the array.– Write a loop that calculates and prints out the maximum value of the array.– Write a loop that calculates and prints out the average value of the array.arrow_forward
- /*In this program you need to implement four methods with the following signatures:printArr(int[] a)add(int[] a, int[] b)subtract(int[] a, int[] b)negate(int[] a) 1. Method printArr(a) should print out all elements of a given int array in one line. 2. Method add(a, b) should take two int arrays (assume they have the same length) and return a new array each element of which will be the sum of the corresponding elements in a and b 3. Method subtract(a, b) is similar to add(), except it returns (a - b) array 4. Method negate(a)takes an int array and returns a new array in which every element is multiplied by -1. */ public class ArrayOperations{ public static void main(String[] args){ //The main only has the testing code. //You don't have to change it. int [] a = { 1, 2, 3, 4, 5}; int [] b = {10, 1, 3, 5, 7}; System.out.print("a = "); printArr(a);//Should print each element of a (in one line) System.out.print("b = ");…arrow_forwardReal World Example You work at a car dealership and your boss asks you to get the color of a car. He tells you the parking lot to get it from (the object you're searching) and then writes exactly where it is. row1 [0].color, he could also give you this direction as an array ["row1", "[0]", "color"]. If there is no color he tells you to tell him "no color found" (the default value). You follow his instructions and return "red". Examples = { "a": [{ "b": { "c": 3 } }] } var object get (object, "a[0].b.c") → 3 get (object, ["a", "0", "b", "c"]) -3 get (object, "a.b.c", "default") "default"arrow_forwardWhen an array is only partly complete, how do you know which items already have data in them?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education