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
Bond [772]
2 years ago
11

Write an enhanced for loop that multiplies all elements in an int[] array named factors, accumulating the result in a variable n

amed product. Numbers.java 123456789101112 public class Numbers{ public int multiply(int[] factors) { int product
Computers and Technology
1 answer:
IgorC [24]2 years ago
8 0

public class Numbers {

   public int multiply(int[] factors){

       int product = 1;

       for (int i : factors){

           product *= i;

       }

       return product;

   }

   public static void main(String[] args) {

       int [] factors = {1,2,3,4,5,6,7,8,9,10,11,12};

       Numbers num = new Numbers();

       System.out.println(num.multiply(factors));

   }

   

}

I hope this helps!

You might be interested in
14. The Internet may best be compared to a/an
finlep [7]
From that particular list, the item that best compares to the internet
is B. a large network of roads.
7 0
3 years ago
Read 2 more answers
In a batch operating system, three jobs are submitted for execution. Each job involves an I/O activity, CPU time and another I/O
Ilia_Sergeevich [38]

Answer:

a) CPU utilization for uniprogramming system = 18.2%

b) CPU utilization for multiprogramming system = 41.379%

Explanation:

IO time = total time – CPU time

For JOB 1  

CPU time = 3ms ,

total time= 23ms

IO time = 23-3 = 20ms ,

For JOB 2

CPU time =5ms

total = 29ms

IO time = 29-5 = 24ms  

For JOB 3  

CPU time = 4ms

total = 14ms

IO time = 14-10 =10ms  

1.) In uniprogramming system, operations are performed sequentially

CPU utilization=total CPU time / total real time

CPU utilization =(3+5+4) / (23+29+14)

CPU utilization =0.182 or 18.2%

2) In multiprogramming system, jobs wait for the CPU to get free while performing IO operations concurrently

steps followed by the os

1. IO for 1st job                           at 0ms

2. IO for 2nd job                          at 0ms

3. IO for 3rd job                          at 0ms

4. CPU time for 3rd job              at 5ms

5. Next IO job for 3rd job           at 9ms END at 14ms

6. CPU time for 1st job              at 9ms

7. Next IO job for 1st job           at 14ms END at 23ms

8. CPU time for 2nd job             at 14ms

9. Next IO job for 2nd job          at 15ms END at 29ms

CPU time is 3+5+4 =12ms

Total execution time = 29ms

CPU utilization = 12*100/29= 41.379%

5 0
2 years ago
Define a function compute_gas_volume that returns the volume of a gas given parameters pressure, temperature, and moles. Use
jeyben [28]

Question:

Define a function compute_gas_volume that returns the volume of a gas given parameters pressure, temperature, and moles. Use the gas equation PV = nRT, where P is pressure in Pascals, V is volume in cubic meters, n is number of moles, R is the gas constant 8.3144621 ( J / (mol*K)), and T is temperature in Kelvin.

Answer:

This solution is implemented in C++

double compute_gas_volume(double P, double T, double n){

   double V = 8.3144621 * n * T/P;

   return V;

}

Explanation:

This line defines the function, along with three parameters

double compute_gas_volume(double P, double T, double n){

This calculates the volume

   double V = 8.3144621 * n * T/P;

This returns the calculated volume

   return V;

}

To call the function  from the main, use:

<em>cout<<compute_gas_volume(P,T,n);</em>

<em />

<em>Where P, T and n are double variables and they must have been initialized</em>

5 0
3 years ago
How teachers apply stenhouse theory
Scilla [17]

Answer:

In curriculum, a vision of knowledge, the role of the educator and a concept of the process of education are all present. In this sense, Stenhouse suggests that the role of teachers and professors is fundamental in the elaboration and implementation of curriculum.

3 0
2 years ago
Write a Console Java program to implement the following Sorting Program.
belka [17]

Answer:

Complete working code is available now.

Explanation:

Visit: gotit-pro.com/write-a-console-java-program-to-implement-following

Feel free to reach out to me for fastest, top-notch and impeccable homework help.

Thanks and Best Regards: Your Friendly Study Co-Pilot

6 0
3 years ago
Other questions:
  • According to the appendix what was the purpose of newspeak
    12·1 answer
  • Because log-on procedures may be cumbersome and tedious, users often store log-on sequences in their personal computers and invo
    6·1 answer
  • Samantha has to create a video for her science project on the blossoming of a flower from a bud to one with fully opened petals.
    5·2 answers
  • When was internet started in which year​
    13·2 answers
  • Which C99 function can be used to convert a string to a double?
    15·1 answer
  • What are examples of templates the Input Mask Wizard offers? Check all that apply.
    12·2 answers
  • What goals do you set for yourself while studying?
    9·2 answers
  • State any three points of importance of local level profession​
    11·1 answer
  • Out-of-order instruction execution can cause problems because a later instruction may depend on the results from an earlier inst
    6·1 answer
  • How to install an older version of prettier on yarn
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!