1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mademuasel [1]
3 years ago
14

Create a new class MyArray_DE and copy and paste the previous program. Be sure to rename the class to MyArray_DE. Modify the pro

gram so that it sums up only the even numbers. PART E. At the end of the program, write a FOR loop that prints the array in reverse (you are not reversing the array; you are simply printing it). Test your program with all the above test cases.
Computers and Technology
1 answer:
vova2212 [387]3 years ago
4 0

Answer:

public class MyArray_DE

{

public static void main(String[] args) {

    int[] numbers = {28, 7, 92, 0, 100, 77};

    int total = 0;

    for (int i=0; i<numbers.length; i++){

        if(numbers[i] % 2 == 0)

            total += numbers[i];

    }

 System.out.println("The sum of even numbers is " + total);

 System.out.println("The numbers in reverse is ");

 for (int i=numbers.length-1; i>=0; i--){

        System.out.print(numbers[i] + " ");

    }

}

}

Explanation:

Since you did not provide the previous code, so I initialized an array named numbers

Initialize the total as 0

Create a for loop that iterates through the numbers

Inside the loop, if the number % 2 is equal to 0 (That means it is an even number), add the number to total (cumulative sum)

When the loop is done, print the total

Create another for loop that iterates through the numbers array and print the numbers in reverse order. Note that to print the numbers in reverse order, start the i from the last index of the array and decrease it until it reaches 0.

You might be interested in
When Mark completed his research paper, he decided that he wanted to have all headings to be in bold, underlined, and 14 points.
MatroZZZ [7]

CTRL/CMD + B (BOLD)

CTRL/CMD + U (Underline)

CTRL/CMD + ] or [ (change font size)

6 0
3 years ago
Colours can be contrasting if<br>​
abruzzese [7]

.....If the colors are from different segments of the color wheel.

3 0
2 years ago
In photoshop what should you consider when determining a projects purpose and objectives?
Darina [25.2K]

Answer:

Identify the purpose, audience, and audience needs for preparing image,Identify three phases that might appear in a project plan. When planning your design project you might include on an outline the goals.

4 0
2 years ago
Which bus slot provides the highest video performance​
Sphinxa [80]

Answer: PCI, The PCI provides the highest performance

4 0
3 years ago
Files exist on ____ storage devices, such as hard disks, dvds, usb drives, and reels of magnetic tape.
Verdich [7]
<span>Files exist on data storage devices, such as hard disks, DVDs, USB drives, and reels of magnetic tape.
</span>Data storage<span> is the recording (storing) of information (data) and </span><span>these data storage devices use</span> a technology consisting of computer components and recording media used to retain digital data.DVDs, USBs and hard disks are examples for external data storage devices.
8 0
3 years ago
Other questions:
  • How do I connect my CSS file and HTML page together? it's just not wanting to work for me. 
    5·1 answer
  • The Mail Merge option is located in which tab? a;home b;insert c;refernces d;mailings
    11·2 answers
  • list = 7 # these many modified Fibonacci numbers. def fibonacci_gt(n, t1, t2): if n&lt;0: print("Incorrect input") elif n == 0:
    12·1 answer
  • Explain how arrays are stored in memory? Show how arr [5] is stored in the memory. Assume each memory location is one byte long
    6·1 answer
  • A company accidentally sends a newsletter with a mistyped website address. The address points to a website that has been spoofed
    8·1 answer
  • Citing Wikipedia as a reference is not considered a good practice because 1.leverages a neutral point of view. 2.hosts unopinion
    8·1 answer
  • Overview In this assignment, you will gain more practice with designing a program. Specifically, you will create pseudocode for
    7·1 answer
  • If you were practicing keyboarding and the exercise contained the letters j, k, l, m, n, and b, what section of the
    14·1 answer
  • How does xm satellite deter nonsubscribers from listening to its transmissions? Does this make the radio programing a private go
    10·1 answer
  • a data analyst is working with a spreadsheet that has very long text strings. rather than counting the characters themselves to
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!