
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

Transcribed Image Text:Create a Program that asks for 10 integers (Use Arrays). Afterwards, display a navigation menu and perform the
following:
(1) Display the numbers
(2) Display it in reverse order
(3) Display the values of even indices (0th, 2nd, 4th, 6th, 8th, ..., 2n)
(4) Display the values of odd indices (1st, 3rd, 5th, 7th, 9th,.., 2n+1)
(5) Ask for an index k, then rotate array to the right.
(6) Ask for an index k, then rotate the array to the left.
Sample Input
10 45 15 26 35 25 7 12 8 3
1
10 45 15 26 35 25 7 12 8 3
2
10 45 15 26 35 25 7 12 8 3
3
10 45 15 26 35 25 7 12 8 3
4
10 45 15 26 35 25 7 12 8 3
5
2
10 45 15 26 35 25 7 12 8 3
6
2
Expected Output
number: 10 45 15 26 35 25 7 12 8 3
Menu:
1. Display the numbers
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
choice: 1
10 45 15 26 35 25 7 12 8 3
number: 10 45 15 26 35 25 7 12 8 3
Menu:
1. Display the numbers
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
choice: 2
3 8 12 7 25 35 26 15 45 10
number: 10 45 15 26 35 25 7 12 83
Menu:
1. Display the numbers
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
choice: 3
10 15 35 7 8
number: 10 45 15 26 35 25 7 12 83
Menu:
1. Display the numbers
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
choice: 4
45 26 25 12 3
number: 10 45 15 26 35 25 7 12 8 3
Menu:
1. Display the numbers.
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
offset: 2
8 3 10 45 15 26 35 25 7 12
number: 10 45 15 26 35 25 7 12 8 3
Menu:
1. Display the numbers
2. Display it in reverse order
3. Display values of even indices
4. Display values of odd indices
5. Rotate array by k (Forward)
6. Rotate array by k (Backward)
offset: 2
15 26 35 25 7 12 8 3 10 45
Testing Guidelines:
• Assume that the length of the input would be exactly 10 all the time
• Assume that inputs are integers all the time.
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 3 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
- 2.B) Create an application containing an array that stores 20 prices, such as $2.34, $7.89, $1.34, and so on. The application should (1) display the sum of all the prices, (2) display all values less than $5.00, (3) calculate the average of the prices, and (4) display all values that that are higher than the calculated average value Save the file as Prices.javaarrow_forwardmy_round(number, integer): Based on the built-in round(...) function. Takes an integer or float and returns a rounded float value that is the number rounded to the second argument's decimal place. First argument can be any float or integer. Second argument must be an integer. Examples: my_round(1234.5678, 2) and round(1234.5678, 2) should return 1234.57. my_round(1234.5678, -2) and round(1234.5678, -2) should return 1200.0.arrow_forwardpython: numpy def purchases(transactions): """ QUESTION 7 - A high-end store is trying to evaluate the total amount that customer's spend per transaction. They want customers to spend anywhere between $130 and $150 on average. - You need to determine whether the average number spent on each transaction per month is above, between, or below the desired amount. - Transactions is a numpy array containing a date, total amount earned each month, and total number of transactions each month. - Above: month's average amount spent per transaction > 150 - Within Range: 150 >= month's average amount spent per transaction >= 130 - Below: month's average amount spent per transaction < 130 - Return a numpy array with "Above", "Within Range" and "Below" for the average amount spent per transaction per month - THIS MUST BE DONE IN ONE LINE HINT: use np.where() and convert the type of each column to float Args: transactions…arrow_forward
- programming used: javaarrow_forwardWhen traversing an array, which of the following statements does not need to keep track of the individual array subscripts: Do...Loop, For...Next, or For Each...Next?arrow_forwardVariables Primitive Write a java program that asks the user to enter 3 integers. Add the integers and display “The total is “ the result Reference Write a java program that asks the user for their first name and last name. Display “Your full name is “ the first name and last name Arrays One-dimensional Write a java program that creates an array of integers called numbers and contains five elements. Then use a for loop to print them out using println(). Two-dimensional submit your code for the total of rows and total of columns herearrow_forward
- Python question Application: Python Fragment Formulation (Q1 – Q4) In this group of questions you are asked to produce short pieces of Python code. When you are asked to "write a Python expression" to complete a task, you can either give the expression in one line or break down the task into several lines. The last expression you write must represent the required task. Question 1 (Reduce parentheses) Give an equivalent version of this expression by removing as many redundant parentheses as possible, without expanding the brackets or simplifying. (x**(2**y))+(y*((z+x)**3)) Question 2 (Translate arithmetic concept into Python) You are given a list of numbers, named numbers, containing 3 integers. Write a python expression (one line) that evaluates to True if and only if the product of any two numbers in the given list is greater than the sum of all three numbers. Note: the product of two numbers, x and y is x*y. Question 3 (List/table access) You are given a table,…arrow_forwardPython: numpy def serial_numbers(num_players):"""QUESTION 2- You are going to assign each player a serial number in the game.- In order to make the players feel that the game is very popular with a large player base,you don't want the serial numbers to be consecutive. - Instead, the serial numbers of the players must be equally spaced, starting from 1 and going all the way up to 100 (inclusive).- Given the number of players in the system, return a 1D numpy array of the serial numbers for the players.- THIS MUST BE DONE IN ONE LINEArgs:num_players (int)Returns:np.array>> serial_numbers(10)array([1. 12. 23. 34. 45. 56. 67. 78. 89. 100.])>> serial_numbers(12)array([1. 10. 19. 28. 37. 46. 55. 64. 73. 82. 91. 100.])""" # print(serial_numbers(10)) # print(serial_numbers(12))arrow_forwardCan you write it in Java, add comments Create an application containing an array that stores eight integers. Prompt the user to enter the 8 integers. The application should call five methods that in turn (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the integers, (4) display all values less than the calculated average value, and (5) display all values that are higher than the calculated average value. Save the file as ArrayMethodDemoarrow_forward
- Create a Console application that does the following:This program must use a single array to store integers and find the maximum value.1. Create an array and initialize it internally with the values 5, 8, 9, 4, and 2.2. Use a loop to iterate through the array and determine the maximum value.arrow_forwardThere are 2 arrays, the first contains item numbers in inventory and the second parallel array contains the price of the items. The user will enter the item number they want to purchase, the program checks to see if it is a valid entry. If it is valid, it will tell the user the price of the item. If it is an invalid item, a message will display telling the user they entered an invalid item. Type up the code below, execute the program a few times.arrow_forwardThe text presented the Sierpinski triangle fractal. Inthis exercise, you will write a program to display another fractal, called the Kochsnowflake, named after a famous Swedish mathematician. A Koch snowflake iscreated as follows:1. Begin with an equilateral triangle, which is considered to be the Koch fractalof order (or level) 0, as shown in Figure a.2. Divide each line in the shape into three equal line segments and draw an outwardequilateral triangle with the middle line segment as the base to create aKoch fractal of order 1, as shown in Figure b.3. Repeat Step 2 to create a Koch fractal of order 2, 3, . . . , and so on, as shownin Figures c and d.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