Question
Application Development with DB VectorsAssignment This Homework Assignment is designed to develop your ability to create static methods and manipulate 1D arrays in Java. We
Application Development with DB VectorsAssignment This Homework Assignment is designed to develop your ability to create static methods and manipulate 1D arrays in Java. We will use the concepts of vectors in Linear Algebra as the theme for this assignment. Slides 4 and 5 provide a summary explanation of vectors sufficient enough for our purposes at this point. We will learn more about vectors later. Create a single Java class [yourLastName]Vector and inside the class create the specified static methods as described on slides 7 14. 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. Submit this assignment as a single .java file that contains all the code required to fulfill the requirements of the assignment.Objectives Define utilizing 1D Arrays in Java as vectors to discuss linear algebra concepts. 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 vectorsVectors Components can be thought of as projections of the vector on a set of mutually perpendicular axis. A vector is a geometric object that has both magnitude and direction. Vectors are defined by their components which add up to form the vector. A 2D vector exists in 2D space while a 3D vectors exists in 3D space. Vectors can be n- components (or n- dimensional) and they would exists in nD space.Representing Vectors in Java In Java, we can think of a 3D (3 component) vector as a 1D array of length 3. For the purposes of our class we will only use 3 component vectors. 0 1 2 4 5 1Code Example: Display Vector TASK #0 Create a static method that accepts a 1D integer array and displays its contents to the console as shown. Your output of a vector should be formatted as shown belowCreate a Vector (Known Dimensions) 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. 4 5 1 0 1 2 4 5 1Create a Vector (Random Dimensions) 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. 8 3 4 Randomly generated integers between 0 and 9 inclusive utilizing Math.random() method 0 1 2 8 3 4Magnitude 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. 0 1 2 8 3 4 || V1|| V 1 8 2 2 9.4 3 + 3 + 4 2Add Two Vectors 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. 0 1 2 0 1 2 0 1 2 8 3 4 7 4 1 15 7 5 V 1 V 2 V1 + V2Subtract Two Vectors 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 . 0 1 2 0 1 2 0 1 2 8 3 4 7 4 1 1 -1 3 V 1 V 2 V1 - V2Scalar Multiplication 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. 0 1 2 8 3 4 V 1 3 0 1 2 24 9 12 3V 1Dot (scalar) Product 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. 0 1 2 0 1 2 8 3 4 7 4 1 V 1 V 2 7 2 V1 V2 (8 x 7) + (3 x4) + (4 x 1)Orthogonal Vectors 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. 0 1 2 0 1 2 2 3 1 3 1 -9 0 8 V 1 1 2 0 3 4 7 V 1 V 2 1 2 4 1 V 2 True Fals eEuclidean Distance 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). 0 1 2 0 1 2 8 3 4 x 1 y 1 z 1 0 V 1 1 2 0 1 2 7 4 1 x 2 y 2 z 2 V 2 3.3 1 2 2 2 x x + y y + z z ( ) ( ) ( ) 2 1 2 1 2 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started