Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

1) Write a java program that prompts the user to enter ten integer values and reads them into an array.
The program should consist of the following methods:
• a method named countOccurences that accepts an array of integer values and an
integer search value. This method should return the number of occurrences of the
integer search value.
• a method named searchIndex that accepts an array of integer values and an integer
search value. This method should return the index of the last occurrence of the search
value. If the search value does not occur in the array the method should return -1.
• a method named sumWithoutSmallest that accepts an array of integer values and
returns the sum of all the values in the array except the smallest one.
Invoke the above methods and demonstrate them in the program. Save the program as
ArrayOperations.java.
Here is a sample run:
Enter ten numbers: 2 3 4 4 2 7 4 5 6 3
Enter a search value: 4
The number 4 occurs 3 times in the array
The last occurrence of number 4 is at index position 6
The sum of all the values in the array except the smallest is:
36

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education