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
Discuss the core technologies and provide examples of where they exist in society. Discuss how the core technologies are part of
Vika [28.1K]

Answer:

Part A

The core technologies are the technologies which make other technologies work or perform their desired tasks

Examples of core technologies and where they exist are;

Thermal technology, which is the technology involving the work production, storage, and transfer using heat energy, exists in our refrigerators, heat engine, and boilers

Electronic technology is the technology that involves the control of the flow of electrons in a circuit through rectification and amplification provided by active devices. Electronic technology can be located in a radio receiver, printed circuit boards (PCB), and mobile phone

Fluid technology is the use of fluid to transmit a force, provide mechanical advantage, and generate power. Fluid technologies can be found in brakes, automatic transmission systems, landing gears, servomechanisms, and pneumatic tools such as syringes

Part B

The core technologies are the subsystems within the larger systems that make the larger systems to work

The thermal technology in a refrigerator makes use of the transfer of heat from a cold region, inside the fridge, to region of higher temperature, by the  use of heat exchange and the properties of the coolant when subjected to different amount of compression and expansion

The electronic technologies make it possible to make portable electronic devises such as the mobile phones by the use miniaturized circuit boards that perform several functions and are integrated into a small piece of semiconductor material

Fluid technologies in landing gears provide reliable activation of the undercarriage at all times in almost all conditions such that the landing gears can be activated mechanically without the need for other source of energy

Explanation:

6 0
3 years ago
which of the following types of software is for organizing analyzing and storing data in a table A spreadsheet software B databa
Komok [63]

Answer:

B) Database Software

Explanation:

Desktop Publishing software and Multimedia software is not used for storing data, so it can't be that. Spreadsheet software stores data in cells, while Database software stores data in tables.

6 0
3 years ago
Translate the following MIPS code to C. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3
Romashka [77]

Answer:

f = 2 * (&A[0])

See explaination for the details.

Explanation:

The registers $s0, $s1, $s2, $s3, and $s4 have values of the variables f, g, h, i, and j respectively. The register $s6 stores the base address of the array A and the register $s7 stores the base address of the array B. The given MIPS code can be converted into the C code as follows:

The first instruction addi $t0, $s6, 4 adding 4 to the base address of the array A and stores it into the register $t0.

Explanation:

If 4 is added to the base address of the array A, then it becomes the address of the second element of the array A i.e., &A[1] and address of A[1] is stored into the register $t0.

C statement:

$t0 = $s6 + 4

$t0 = &A[1]

The second instruction add $t1, $s6, $0 adding the value of the register $0 i.e., 32 0’s to the base address of the array A and stores the result into the register $t1.

Explanation:

Adding 32 0’s into the base address of the array A does not change the base address. The base address of the array i.e., &A[0] is stored into the register $t1.

C statement:

$t1 = $s6 + $0

$t1 = $s6

$t1 = &A[0]

The third instruction sw $t1, 0($t0) stores the value of the register $t1 into the memory address (0 + $t0).

Explanation:

The register $t0 has the address of the second element of the array A (A[1]) and adding 0 to this address will make it to point to the second element of the array i.e., A[1].

C statement:

($t0 + 0) = A[1]

A[1] = $t1

A[1] = &A[0]

The fourth instruction lw $t0, 0($t0) load the value at the address ($t0 + 0) into the register $t0.

Explanation:

The memory address ($t0 + 0) has the value stored at the address of the second element of the array i.e., A[1] and it is loaded into the register $t0.

C statement:

$t0 = ($t0 + 0)

$t0 = A[1]

$t0 = &A[0]

The fifth instruction add $s0, $t1, $t0 adds the value of the registers $t1 and $t0 and stores the result into the register $s0.

Explanation:

The register $s0 has the value of the variable f. The addition of the values stored in the regsters $t0 and $t1 will be assigned to the variable f.

C statement:

$s0 = $t1 + $t0

$s0 = &A[0] + &A[0]

f = 2 * (&A[0])

The final C code corresponding to the MIPS code will be f = 2 * (&A[0]) or f = 2 * A where A is the base address of the array.

3 0
3 years ago
Anyone help me please​
MissTica

Answer:

1. True

2. False

3. True

4. False

5. True

6. True

7. False

4 0
3 years ago
Read 2 more answers
Write an example method that overrides the operator to create a new book whose title is a concatenation of the titles of two boo
Anastasy [175]

next time m8 mmmmmdsaasd

5 0
3 years ago
Other questions:
  • Julio is the department head for his company's customer service department. His staff has complained that they spend countless h
    13·2 answers
  • In an advanced word processing program which type of image or graphic is available in a variety of formats and styles?
    12·2 answers
  • PLEASE PLEASE PLEASE PLEASE HELP ASAP!!!!! I PROMISE I WILL GIVE YOU A BRAINLIEST FOR THE CORRECT ANSWER PLEASE HELP!!
    9·2 answers
  • What is an efficient way to ensure that the code is working as per the acceptance criteria/business requirements? (1 correct ans
    11·2 answers
  • Knowing what you know about today’s video games, imagine what it would look like if you had to create a modern-day version of Sp
    6·1 answer
  • What are two example of ways an electronic record may be distributed to others?
    11·1 answer
  • IMPORTANT!!<br><br> How can you get real answer keys for edmentum (plato) courses as a student?
    11·1 answer
  • What do earthquakes and tsunamis have in common?
    13·1 answer
  • After a group sets a project schedule, members should be prepared to
    7·1 answer
  • Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to in
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!