Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

AP Computer Science A Lab 8 Lab 8: One-Dimensional Arrays Note: All of your scripts must begin with a comment block that is similar to

image text in transcribed

AP Computer Science A Lab 8 Lab 8: One-Dimensional Arrays Note: All of your scripts must begin with a comment block that is similar to the following //File: fileName.java //Author: Your name here //Date: Today's date //Class: AP Computer Science A //Teacher: Mr. Giguere //Code Description: Insert short description of code (i.e. what it does) You should also be commenting on each line of your code, writing short descriptions of what the purpose of the line is. Any printed values must be accompanied by a text description of what the values are. You may not use array lists in this lab -you must use arrays for any credit 1. In mathematics, the inner product1 of two vectors is the sum of the products resulting from element- wise multiplication, where both vectors must have the same number of dimensions. If u - ui U22 + + tren and v = ulei + U22+ + vnn, then the inner product of vectors u and v is As a quick example, the inner product of the two vectors is easily found as follows: u-v-(4 x 2) + ((-3) x 7) + (5 x (-4)--33 Write a static method that takes in two vectors and outputs their inner product. Your method should print an error message if the vectors have different lengths. 2. Write a class called Words, which consists of a single instance vatiable wordArray, an array of String objects. Aside from the main) method, the class should contain a getNext ) method which returns a random word from the wordArray instance variable and updates wordArray so that it no longer contains the chosen word. If there are no words in the array, it should return the string "NONE". For example, if the main() consisted of the following public static void main (Stringl args) "epic"); String[] stringArray= {"okay", "this", "is", Words vordArray nev Words(stringArray); for (int i-0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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