ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 11.00

public static double createArray

Please provide a solution for the document below using Java. 

 

 

1. Create a static method with the following definition
public static double createArray (int size)
The method should create a new empty array of doubles, of size ‘size’ and return a reference to that
array (see sample code) 2. Create an instance method with the following definition:
public void printArray(double inputArray)
The method should print all the element in the array inputArray (see sample code) 3. Create an instance method with the following definition.
public void initArrayLinearAscending(double inputArray)
The method should initialize the array inputArray to values from 1 up to the size of the array. For
example inputArray[0]= 1, inputArray[1] = 2, inputArray[2] = 3, and so on. (see initArray method in
sample code).
4. Create an instance method with the following definition.
public void initArrayLinearDescending (double inputArray)
The method should initialize the array inputArray to values from inputArray.length up to the size of the
array. For example inputArray[0]= 1, inputArray[1] = 2, inputArray[2] = 3, and so on. (see initArray
method in sample code)
5. Create an instance method with the following definition.
public void squareArray (double inputArray)
This method should update each cell in the inputArray to the square of its current value. For example,
inputArray[0] = inputArray[0] * inputArray[0]
6. Create an instance method with the following definition.
public void addScalar (double inputArray, double scalar)
This method should update each cell in the inputArray by adding the value ‘scalar’ to each element in
the array
7. Create an instance method with the following definition.
public void multiplyByScalar (double inputArray, double scalar)
This method should update each cell in the inputArray by multiplying each cell by the value ‘scalar’
8. Create an instance method with the following definition. public double multiplyArrays (double inputArray, double inputArray2)
This method should return a new array whose cell is the result of multiplying the corresponding cells of
inputArray and imputArray2 (i.e. newarray[0] = inputArray[0] * inputArray2[0].
9. Create an instance method with the following definition.
public void subtractScalar (double inputArray, double scalar)
This method should update each cell in the inputArray by subtracting the value ‘scalar’ to each element
in the array. Part B
Use the methods you created above to implement the following functionality.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25. Create an array of type double and size 2000, and name it johnArray.
Initialize the array johnArray to values from 2000 down to 1
Calculate the sum of all element in johnArray and print the result.
Create a new array of type double and size 2000, and name it mariaArray.
Initialize the array mariaArray to values from 1 to 2000
Declare a new array of type double with the name johnReferenceArray
Assign johnArray to johnReferenceArray.
Create a copy of mariaArray and assign it to a variable named mariaCopyArray
Add the value 100 to all element of mariaCopyArray.
Print the sum of mariaCopyArray then print the sum of mariaArray. Are the two sums the same
or different? Why?
Add the value 100 to all element of johnReferenceArray.
Print the sum of johnReferenceArray, then print the sum of johnArray. Are the two sums the
same or different? Why?
Print the sum of johnArray, then multiply all element in the johnReferenceArray by the value 5,
and then print the sum of johnArray again? Are the two sums the same or different? Why?
Print the sum of mariaArray, then multiply all element in the mariaCopyArray by the value 5,
and then print the sum of mariaArray again? Are the two sums the same or different? Why?
Multiply the mariaArray and johnArray, and save the result in a new array called
mariaTimesJohnArray.
Print all element of the mariaTimesJohnArray
Calculate the sum of mariaTimesJohnArray.
Print the sum of all elements in the mariaTimesJohnArray.

Attachments:

Answers

(11)
Status NEW Posted 02 May 2017 07:05 AM My Price 11.00

-----------

Attachments

file 1493711732-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)