Computers and Technology

The following code segment is part of a bigger program to multiply the corresponding values of two arrays, a1 and a2. arrays a1 and a2 are declared and initialized to store a certain number of doubles.

double[ ] a1 = new double[some length];
double[ ] a2 = new double[some length];
// assume that there is code here that prompts the user to enter these double
// values and stores them in a1 and a2. you don't know what the user will type, but
// you may assume that the code is correct and no errors occur in this portion of the program.

// complete your code below this line

add code to do the following:

declare an additional array of of doubles (based on the length of a1 or a2)
fill the new array with the product of the corresponding elements in a1 and a2
print the values stored in the new array to the screen

complete the code segment to accomplish the additional tasks described.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, jhit
Matlab question: use switch and anythe lottery game matches three different integer numbers between 1 and 10. winning depends on how many matching numbers are provided by a player. the player provides three different integers between 1 and 10.if there is a match of all 3 numbers, the winning $ 1000.if there is a match with 2 numbers, the winning $ 10.if there is a match of all with 1 numbers, the winning $ 1.with no match, the winning is $0.write a function lottery3 that checks three numbers provided by a player and determine the winning amount. if the user mistakenly enters same number twice/thrice and if that number matches one of the winning numbers, the code should count that number only once and display correct result. the player doesn’t have to guess the order of numbers. the input to the function lottery3 can have up to two input arguments. the first input argument is a row array numbers with 3 numbers. if the second argument input testcode is present, and is a row vector of 3 values, the function lottery3 uses the code in testcode as the three winning numbers (the test must be three different integer numbers between 1 and 10), else three different numbers will be automatically generated by testcode. the ouput should return the variable winnings and the three winning numbers in the row array winnumbers. hint: make use of the internal function any. restriction: the function must use switch-case statements to determine the winning. example #1: winning = lottery3( [1,2,1],[1,2,3])produceswinning =10example #2: [winning, winnumbers] = lottery3( [1,2,3])produceswinning =3winnumbers =8 5 3
Answers: 1
image
Computers and Technology, 22.06.2019 15:30, alexdub9649
What is a costume plot? why is it important to a film or theater production?
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, victordhernandez01
Jake really works well with numbers and is skilled with computers but doesn't work well with others. which of the jobs discussed in this unit might be best for jake? why?
Answers: 3
image
Computers and Technology, 23.06.2019 18:00, sophx
Apunishment or the threat of punishment used to enforce conformity. select the best answer from the choices provided t f
Answers: 1
Do you know the correct answer?
The following code segment is part of a bigger program to multiply the corresponding values of two a...

Questions in other subjects:

Konu
Social Studies, 06.10.2019 04:01