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

Program this in java:

a. I input an array of integers: int[] arr = { 4, 100, 2, 50, 7, -45, -23, 84, 51, 120, 98, -72 }.
b. Declare an integer variable that named "total".
c. create a loop.
d.1. The loop control variable value to be declared is 0. This will be represented by the variable "i" and it represents the index of the inputted array.
e.2. The loop has a condition that if the current loop control variable value is greater than or equal to the size of the array minus the first item of the array, the loop will break.
f.3. After the body or function is executed, the loop control variable is incremented by 2.
g.4. The body of the loop has a conditional statement. if arr[i] is even, add it to total, else minus it to the total.
g. After the loop breaks or finishes, display the value of the total.

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
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