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
Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of
which is between 10 and 100, inclusive. As each number is read, validate it and store it in
the array only if it is not a duplicate of a number already read. After reading all the values,
display only the unique values that the user entered. Provide for the “worst case” in which
all 20 numbers are different. Use the smallest possible array to solve this problem.
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 5 steps with 2 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
- To find out how many rows there are, use Array.length, and to find out how many columns are in a certain row, use array[FALSE or TRUEarrow_forwardhow to do it? need helparrow_forwardUse a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 20 and 50, inclusive. As each number is read, validate it and check its value. Numbers greater than 40 are to be stored as they are. Numbers that are less than or equal to 40 should be doubled and then stored. After reading all the values, display all the values which were stored.arrow_forward
- Program: Using a multidimensional array, create a triangular-shaped array. You will ask the user how many lines they want to see and then create the array, fill it, and then print it. You will fill the array with one 1 in the first row, two 2’s in the second row, etc. This should work for any integer that the user enters. (Just because I am starting on 1 does not mean row 0 was skipped.) You must: use a loop to create the array shape. You must: use nested for loops to fill the array and to print the values back to the screen. Your program should print as shown below. Example Output: How many lines would you like in your triangle? >>>9 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 If your code looks like the code below, it is not what I’m asking for. The code below is making a square multidimensional array, not a triangular one. The code below is just leaving certain spots empty so that it looks like a triangle. I will ask you…arrow_forwardUse C#, and explain each step please. Use a one-dimensional array to solve the following problem: Write an app that inputs five numbers, each between 10 and 100, inclusive. As each number is read, display only if it's not a duplicate of a number already read. Provide for the "worst case," in which all five numbers are different. Use the smallest possible array to solve this problem. Display the complete set of unique values after the user inputs each new value.arrow_forward2. Use a two-dimensional (double-subscripted) array to solve the following problem: A company has four salespeople who sell five different products. Let each salesperson represent a row of your array and each product a column. You now have a 4 x 5 array. Once a day, each salesperson submits a slip for each different type of product he or she sold. Each slip contains: The salesperson’s number (1 to 4) (use this to get row subscript) The product number (1 to 5) (use this to get column subscript) The total dollar value of that product sold that day Thus, each salesperson submits from 0 to 5 sales slips per day (0, if they made no sales that day; and 5, if they sold every product that day). Your program will read a file that contains the information from all of the sales slips for the last month. Read until EOF. The file is named "productSales.txt". You need to create this file with at least 10 entries. Remember that the first number is the salesperson, the second number is the product,…arrow_forward
- In [ ]: We obtained an array with N = 10 values, scattered about mean of 25 (mm). Let's calculate the mean, standard deviation, standard deviation of the mean and 20-uncertainty SL of these numbers. In the following code, do these steps: • In the first cell, add a brief comment that explains what each statement does. Start each comment with a # sign. • In the second cell, delete the raise Not ImplementedError() code line and print the standard deviation and 20-uncertainty on the screen (follow the example for mean_L) mean_L = np.mean (L) print("Mean length: ", mean_L) stddev_L = np. std (L, ddof=1) stddev_mean_L = stddev_L/np.sqrt(N) uncertainty_L = 2*stddev_mean_L In [ ] V #YOUR CODE HERE raise NotImplementedError() #calculates the mean of L In the above code, the green expressions on the right hand side, such as np.mean, np. std and np.sqrt are functions built into the numpy package of Python. The names on the left hand side are variable names invented by me.arrow_forwardse for loops on the above 2D array to: •Find how many ZEROsand how many negative numbersare in the matrixand display results*HELP: declare a variable “count_zero= 0and count_neg=0” and increment the count each time you findzero and negativearrow_forwardNote: Set a random seed of 100 for this assignment. All arrays should contain random numbers between 0 and 1 (zero is inclusive). Create a one-dimensional array of twenty float random numbers. Assign the sum of these values to Q1. Assign the max of these values to Q2. Create a four by five array of random numbers. Take the minimum values in each array and create an array of those values. Assign it to Q3. Assign the mean of all the array values to Q4. Create an array with the following values: 2, 3, np.nan (this should represent a missing value), and 5. Use a numpy function to find the sum of the values in this array. Assign the sum to Q5 (you should expect a numerical value here). Create two separate arrays each containing four random numbers. Concatenate the two arrays and assign it to Q6. Create a four by four array of random numbers and call it q7. Concatenate this array with itself and assign it to Q7. Create a two by four array of…arrow_forward
arrow_back_ios
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