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
Anestetic [448]
3 years ago
8

1. Write a static method named computeOddSum that is passed an array of int's named numbers. The method must compute and return

the sum of all the values in numbers that are odd. For example, if numbers is {3, 10, 11, 2, 6, 9, 5} then the value 28 should be returned since 3 11 9 5
Computers and Technology
1 answer:
S_A_V [24]3 years ago
5 0

Answer:

The method in Java is as follows:

public static int computeOddSum(int [] myarray){

       int oddsum = 0;

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

        if(myarray[i]%2==1) {

           oddsum+=myarray[i];

        }

     }

     return oddsum;

   }

Explanation:

This defines the static method

public static int computeOddSum(int [] myarray){

This initializes oddsum to 0

       int oddsum = 0;

This iterates through the array

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

This checks for odd number

        if(myarray[i]%2==1) {

The odd numbers are added, here

           oddsum+=myarray[i];

        }

     }

This returns the calculated sum of odd numbers

     return oddsum;

   }

To call the method from main, use:

<em>int [] myarray = {3, 10, 11, 2, 6, 9, 5};</em>

<em>      System.out.println("Odd sum = " + computeOddSum(myarray));</em>

You might be interested in
Which individual of the following would be most likely to be directly concerned with web security?
prohojiy [21]
Network Engineer is correct.
4 0
3 years ago
Read 2 more answers
1. A video card on a modem motherboard would run best in which type of slot?
Gnoma [55]

Answer:

2.PCIe

Explanation:

When the PCI EXPRESS was not made, the PCI used to be the best type of slot for the video card on the modem motherboard. However, with the arrival of PCIe or the peripheral component interconnect express, we got an interface standard that could be used for connecting the components with very high speed. And each of the PC motherboards comes with numerous PCIe slots which once can make use of for adding the GPUs like video cards, RAID cards, graphics cards, SSD add on cards, and the Wi-Fi Cards. Thus the correct option above is certainly, 2. PCIe.

3 0
3 years ago
Imagine that you are an independent filmmaker making a feature-length narrative film in the United States, with a variety of bot
Lerok [7]
Although an 8mm or 16mm would be better cost wise, I personally would use a 35 mm camera for this type of film. The 35mm is the only camera that would work well on a big screen. It is a rather expensive camera but no other camera could fit on the big screen.
7 0
3 years ago
Read 2 more answers
Which of the following statements is true for DMA: (only one correct answer) A. In DMA, Processor checks status until the operat
Ronch [10]

Answer:

<u>D. In DMA, interrupt is sent when the task is completed</u>

Explanation:

Note, the term Direct Memory Access simply refers to a computer feature that allows hardware subsystems to directly access the main system memory of a computer, without any the aid of the central processing unit (CPU).

It is a fact that while the transfer process is ongoing, an interrupt (interrupt signal) is not sent until when the task is completed.

6 0
3 years ago
Creating a Venn diagram takes specialized computer software.
DerKrebs [107]

Answer:

F

Explanation:

false because you don't need a computer software to make a venn diagram you can make one

8 0
3 years ago
Read 2 more answers
Other questions:
  • Clip art, by default, is formatted as a(n) ____, which cannot be moved to a precise location on a page.
    14·1 answer
  • What does the following loop do?
    5·1 answer
  • You work in the Accounting department and have been using a network drive to post Excel workbook files to your file server as yo
    15·1 answer
  • Using a caesar cypher with an offset of three characters (a -&gt; d, b -&gt;e, ...., z -&gt; c), what would be the correct cyphe
    6·1 answer
  • PLEASE ANSWER ASAP
    7·1 answer
  • Intranets:
    8·1 answer
  • Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,
    7·1 answer
  • Which of the following is true of binary files?
    6·2 answers
  • ...............is a personal computer that fits on desk.​
    5·2 answers
  • How can i find these services
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!