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
1.Write the Qbasic program to find sum of any 10 different numbers.
dybincka [34]

Answer:

1.

DIM myArray(10) as INTEGER

LET A = 0

FOR I = 1 TO 10 STEP 2

INPUT “INPUT NUMBER”; myArray(i)

LET A = A + myArray(i)

NEXT  

PRINT A

END

2.

REM PROGRAM FOR CALCULATING THE SIMPLE INTEREST

CLS

INPUT “INPUT THE PRINCIPAL”; P

INPUT “INPUT THE TIME”; T

INPUT “INPUT THE RATE”;R

SI = P* T * R / 100

PRINT “SIMPLE INTEREST =”; SI

END

Explanation:

Please find the respective programs in the answer section.

4 0
3 years ago
Becca is working on a program that will store data. The program will need quick access to data and data persistence is not impor
borishaifa [10]

Based on the information given the data should be stored in flash memory.

<h3>What is flash memory:</h3>

Flash memory is a memory storage space that is used to store data or information on a computer.

Flash memory is vital as it help to retain information or data that are stored on a computer after power is removed which inturn means that store data can be retrieve when needed.

Example of flash memory are:

  • CompactFlash  
  • Memory Stick
  • BIOS chip etc

Inconclusion the data should be stored in flash memory.

Learn more about flash memory here:brainly.com/question/6835146

7 0
2 years ago
Which tab and group will allow the insertion of rows and columns in a worksheet?
ivanzaharov [21]
Home tab, cells group
5 0
2 years ago
Read 2 more answers
In the welding operations of a bicycle manufacturer, a bike frame has a long flow time. The set up for the bike frame is a 7 hou
mestny [16]

Answer:

Bike Frame Flow Time

The value-added percentage of the flow time for this bike frame is:

= 46.

Explanation:

a) Data and Calculations:

Bike Frame Flow Time:

Setup time = 7 hours

Processing time = 6 hours

Storage time = 7 hours

Flow time of the bike frame = 13 hours (7 + 6)

Value-added percentage of the flow time for this bike frame = 6/13 * 100

= 46%

b) Flow time represents the amount of time a bicycle frame spends in the manufacturing process from setup to end.  It is called the total processing time. Unless there is one path through the process, the flow time equals the length of the longest process path.  The storage time is not included in the flow time since it is not a manufacturing process.

8 0
2 years ago
To print the last element in the array named ar, you can write :A. System.out.println(ar.length);
timofeeve [1]

Answer:

Option (d) is the correct answer.

Explanation:

An Array is used to store multiple variables in the memory in the continuous memory allocation on which starting index value is starting from 0 and the last index value location is size-1.

In java programming language the array.length is used to tells the size of the array so when the user wants to get the value of the last element, he needs to print the value of (array.length-1) location so the correct statement for the java programming language is to print the last element in the array named ar is--

System.out.println(ar[ar.length-1]);

No option provides the above statement, so option d (None of these) is correct while the reason behind the other option is not correct is as follows--

  • Option a will prints the size of the array.
  • Option b also gives the error because length is an undeclared variable.
  • Option c will give the error of array bound of an exception because it begs the value of the size+1 element of the array.
3 0
3 years ago
Other questions:
  • Keion works as a freelancer creating websites and designing logos for clients. He recently had a hard drive failure and lost wor
    7·1 answer
  • Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive). Sample output w
    12·1 answer
  • Which file system is designed to verify and autocorrect data faults on the volume without having to bring the volume down for ma
    11·1 answer
  • Video is a medium that's looks real anyways, but is real________________.
    10·1 answer
  • A. What is MS-Word ? Write its uses.
    14·2 answers
  • State three advantages of using a printer​
    15·1 answer
  • What did Bakers wear (1) in the Portugal does (2) when was author was young ???
    10·1 answer
  • Fill in the blanks <br>a) an _______________ checks the files on the computer for viruses.​
    6·2 answers
  • You are given a list of N integers . find the largest sum of a continuous sequence from the given list
    10·1 answer
  • A vlan ________.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!