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]
2 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]2 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
A new employee has reported that print jobs are printing as garbled text. Which of the following is MOST likely the reason for t
e-lub [12.9K]

Answer:

Option (C) is the correct option.

Explanation:

When the printer printing the documents in a distorted way then, the following workstation installed the wrong drivers for the printer. The computer operator or the technician installs the right driver in the computer system or the workstation. That's why the following issues are generating at the time of printing the documents.

4 0
2 years ago
The _____ layer addresses how the software will execute on specific computers and networks.
lidiya [134]

The problem domain layer addresses how the software will execute on specific computers and networks.

A problem domain is a software engineering term that refers to all information that defines a problem and compels the solution.

A problem domain basically looks at only the area you are interested in and excludes the rest. It includes the goals the problem owner wishes to have and the context in which the problem exists. For example, if you are creating a website for selling artwork online, the problem domain will be artwork and eCommerce.

Therefore, in order to identify a problem domain, you need to know the relevant user requirements. This can be easy when you start by finding out what people (users) think the problem is.

#SPJ4

3 0
1 year ago
Read 2 more answers
Which of the following is a default letter assigned for the primary hard drive
d1i1m1o1n [39]

C

.............

When hard disk drives became standard in most PCs in the later 1980s, since the first two letters were already commonly used for these floppy drives, they logically labeled the third storage device “C”, even though it now tended to be the main storage medium for the computer, including usually containing the operating system.

6 0
3 years ago
Read 2 more answers
What two statements about IPv6 addresses are true? This task contains the radio buttons and checkboxes for options. The shortcut
Oliga [24]

Answer:

A and C

Explanation:

Option A:

In IPv6 there is a rule to reduce an IPv6 address when there are two or more consecutive segments of zeros just one time. This rule says that you can change the consecutive zeros for “::”  

Here is an example

How to reduce the following IPv6 address?

ff02:0000:0000:0000:0000:0000:0000:d500

Ans: ff02::d500

Example 2:

2001:ed02:0000:0000:cf14:0000:0000:de95

Incorrect Answer -> 2001:ed02::cf14::de95  

Since the rule says that you can apply “::” just one time, you need to do it for a per of zero segments, so the correct answer is:

Correct Answer -> 2001:ed02::cf14:0:0:de95

Or

2001:ed02:0:0:cf14::de95

Option C:

Since in IPv6 there are 2^{128} available addresses which means 340.282.366.920.938.463.463.374.607.431.768.211.456 (too many addresses), there is no need of NAT solution, so each device can have its own IP address by the same interface to have access through the internet if needed. If not, you can block the access through internet by the firewall.

4 0
3 years ago
A 30V battery maintains a current through a 10 Ω Resistor. What is the current flow through the resistor?
Troyanec [42]

Answer:

3 amps

Explanation:

because as per ohm's law. "electric current is proportional to voltage and inversely proportional to resistance"

7 0
3 years ago
Other questions:
  • The memory allocated for a float value is ____ bytes.
    9·1 answer
  • Who is the owner of microsoft company​
    12·1 answer
  • Put the steps of the decision-making process in the correct order.
    12·1 answer
  • Once a graph has been created, you would need to start over to make any changes to it?
    5·1 answer
  • As a consommé simmers, the meat and eggs coagulate, forming a
    6·1 answer
  • Which option is used to ensure the integrity and authenticity of a Word document but requires additional services to be availabl
    5·2 answers
  • 15) Three primary activities of a program are: A) Variables, Operators, and Key Words B) Lines, Statements, and Punctuation C) I
    11·1 answer
  • Write a void method named myMethod which prints "This is a void method" (without the quotes). Your method should be declared pub
    5·1 answer
  • Which of the examples is part client side code
    10·1 answer
  • with a ____ the traffic of a given enterprise or group passes transparently through an internet in a way that effectively segreg
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!