![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 21.02.2020 20:36 LordBooming
In this assignment, you will make another calculator. This one will work on arrays rather
than single values. Like the basic calculator from the previous assignments, the array
calculator should allow users to add, subtract, multiply and divide the corresponding
values in two arrays. It should also allow users to generate a random array. Finally,
there is a special value that can be computed for two arrays called the dot product that
your calculator should also be able to compute. You can find the definition of the
algebraic dot product of two arrays by googling (Wikipedia is a good choice). Briefly, the
dot product of two arrays is the sum of the product of the corresponding values in the
arrays.
For example, the dot product of [1, 5, 8, 2] and [2, 4, 1, 3] is:
(1 * 2) + (5 * 4) + (8 * 1) + (2 * 3)
which is 36.
Your array should have the same methods as the calculator from Assignment 4, plus a
method to compute the dot product. These methods should deal with double arrays
rather than plain doubles, however. Here is a list of the method signatures:
public static int getMenuOption()
public static double[] getOperand(String prompt, int size);
public static double getOperand(String prompt);
public static double[] add(double[] operand1, double[] operand2)
public static double[] subtract(double[] operand1, double[] operand2)
public static double[] multiply(double[] operand1, double[] operand2)
public static double[] divide(double[] operand1, double[] operand2)
public static double[] random(double lowerLimit, double upperLimit, int size)
public static double dotProduct(double[] operand1, double[] operand2)
You will need two versions of the getOperand method. This is an example of method
overloading. The first version will prompt the user for enough values to fill an array and
return the array. This will be used to get the operands for the add, subtract, multiply,
divide, and dotProduct method. The other version does the same thing as in the Fourth
Assignment – Calculator with Methods – it displays a prompt and reads and returns a
double value. This is needed to get the inputs for the random method. The random
method will need one additional parameter – the size of the random array that should be
generated. Note that the dotProduct method only needs to return a single double value
rather than an array.
Here is an example run of the program:
Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Dot product
6. Generate random array
7. Quit
What would you like to do? 1
How many values are in the arrays? 3
Enter the values in the first array, separated by spaces:
2 4 6
Enter the values in the second array, separated by spaces:
1 3 5
The result is [3.0, 7.0, 11.0]
![ansver](/tpl/images/cats/User.png)
Answers: 3
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 02:30
The can be used to paste text in any order
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 14:00
Text or graphics that print at the bottom of every page are called footings footers headers headings
Answers: 1
You know the right answer?
In this assignment, you will make another calculator. This one will work on arrays rather
Questions
![question](/tpl/images/cats/istoriya.png)
History, 04.09.2020 01:01
![question](/tpl/images/cats/mat.png)
Mathematics, 04.09.2020 01:01
![question](/tpl/images/cats/mat.png)
Mathematics, 04.09.2020 01:01
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 04.09.2020 01:01
![question](/tpl/images/cats/en.png)
English, 04.09.2020 01:01
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 04.09.2020 01:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mir.png)
World Languages, 04.09.2020 01:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/en.png)
English, 04.09.2020 01:01
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/mir.png)
World Languages, 04.09.2020 01:01
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/geografiya.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 04.09.2020 01:01