Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a single Java class Vector and inside the class create the specified static methods. In the main method of your class, provide a test

Create a single Java class Vector and inside the class create the

specified static methods.

In the main method of your class, provide a test for each static method so that

when your code is executed it shows that each method works correctly.

Task # Description

1 Create a vector from known components

2 Create a vector from randomly-generated components

3 Calculate the magnitude of a vector

4 Add two vectors

5 Subtract two vectors

6 Multiply a vector by a scalar

7 Determine the dot product of two vectors

8 Determine if two vectors are orthogonal

9 Determine the Euclidean distance between two vectors

TASK #1

Create a static method that accepts 3 integer parameters and returns a 1D integer array containing the parameters as elements in the array. Numbers should be assigned indexes in order [0] [1]etc.

TASK #2

Create a static method that accepts no parameters and returns a 1D integer array containing randomly-generated values between 0 and 9. Numbers should be assigned indexes in order [0] [1]etc.

TASK #3

Create a static method that accepts a 1D integer array and returns a double which is square root of the sum of the squared values in the array. This represents the magnitude of a vector.

TASK #4

Create a static method that accepts two 1D integer array and returns a new 1D integer array which is the result of adding the two parameter arrays together.

TASK #5

Create a static method that accepts two 1D integer array and returns a new 1D integer array which is the result of subtracting the two parameter arrays .

TASK #6

Create a static method that accepts a 1D integer array and an integer (scalar) as parameters and returns a new 1D integer array which is the result of multiplying each value in the array by the integer.

TASK #7

Create a static method that accepts two 1D integer arrays as parameters and returns an integer (scalar) which is the result of multiplying the corresponding individual values of the arrays together and summing the product.

TASK #8

Create a static method that accepts two 1D integer arrays as parameters and returns true if the Dot Product (see slide 13) is 0 and false otherwise.

TASK #9

Create a static method that accepts two 1D integer arrays as parameters and returns a double. This represents the Euclidean distance between the arrays (vectors).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

computer power connector

Answered: 1 week ago

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago