Create at least two vectors and demonstrate the use of each

Assignment Help JAVA Programming
Reference no: EM13781394

For this assignment you will create a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.(Be sure to use the class skeleton provided on D2L)

1. Create a Vector class incorporating the following features:

a. a constructor taking an array of doubles as an argument

b. a toString method returning proper vector notation, e.g< 1.0, -1.0, 0.0, 2.0 >

c. a method to return the size (number of components) of a vector

d. a method to return the norm of a vector

e. a method unitize that will return a unit vector for a given vector

f. a method scale for computing the product of a scalar and a vector

g. a method add for adding two vectors

h. a method dot for computing the dot product of two vectors

i. a method cross for computing the cross product of two vectors (you can assume the vectors passed to the cross product method have size 3, ie< i, j, k >

j. implement parts g, h, and i as static methods

k. the class should properly handle vectors of different sizes

l. methods working with two vectors should check that the input vectors meet the requirements of the operation and if not should return the vector < -0.0001 > for methods returning vectors or -.0001 for methods returning scalars to indicate this failure

2. Create a separate class, VectorTest, that will demonstrate the use of your Vector class. You must create at least two vectors, and demonstrate the use of each method. When you demonstrate the use of each method, print the results to the console in a manner where the values of the vectors are clear, and the method you called as well as its results are clear.

a. Example output: (this does not illustrate the use of all the methods, your VectorTest class should illustrate the use of all of the methods described above).

myVector1 is: <1.0,2.0,3.0>
myVector2 is: <1.0,1.0,1.0>
The sum of myVector1 and myVector2 is: <2.0,3.0,4.0>
The norm of myVector2 is: 1.73
The dot product of myVector1 and myVector2 is: 6.0

Reference no: EM13781394

Questions Cloud

Write an application that uses a one dimensional array : Write an application that uses a one dimensional array: the user enters 5 numbers, each of which is between 10 and 100. As each number in input, display it only if it is not a duplicate of previous numbers entered.
Write a function that accepts an integer parameter : Write a function that accepts an integer parameter and returns its integer square root. The function should throw an exception if it is passed an integer that is not a perfect square. Demonstrate the function with a suitable driver program
Write a program to compute the cumulative gpa : This program will compute the cumulative GPA based on user input.  This program will use dialog boxes with the JOptionPane class as well as the console to send/receive information to/from the user.
Students with severe and multiple disabilities : Visit a program for students with severe and multiple disabilities. During the interview with teachers and staff, discuss the following topics:
Create at least two vectors and demonstrate the use of each : Create a separate class, VectorTest, that will demonstrate the use of your Vector class. You must create at least two vectors, and demonstrate the use of each method. When you demonstrate the use of each method, print the results to the console ..
Discriminatory belief or phobia : Pretend you are a racist, you have this discriminatory belief or phobia. Explain what is being racist? Include an example and explain how it is NOT practicing higher-level thinking. (Intro paragraph)
Create the investment calculator : Create the following GUI that allows a user to calculate the value of an investment after a certain number of years with monthly compound interest.
Organizing function of management : Prepare a 1,050- to 1,400-word paper in which you evaluate the organizing function of management as it relates to at least two of the following organizational resources:
Effective brand name creation : Discuss ten characteristics of effective brand name creation. Then, locate three established brands that meet at least five of the listed characteristics. Explain why you think these brands meet the selected five criteria. Support your choices wit..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Display a welcome message to your user

Write a one screen description of your initial reactions to Java. Reactions may be both positive and negative. At the end of this module you will be asked to write a reply to these initial reactions.

  Details of all advertisers registered with the service

Create a list of 6-7 different customers of both types with made-up details built in to the client program - display the details of all advertisers registered with the service,

  Write an application that uses string method region

Write an application that uses String method region - Matches to compare two strings input by the user. The application should input the number of characters to be compared and the starting index of the comparison.

  Write the logical expression in postfix notation.

Given symbols p, q, r, and s for propositions. Draw the binary tree representation of the logical expression ((p || r) && ! p ) || s) && (q || r). Write the logical expression in postfix notation.

  Design 3 shoppingbay is an online auction service that

3. shoppingbay is an online auction service that requires several reports. design a flowchart or psuedocode this is

  Java program the program has a page that shows the users

java program the program has a page that shows the users name and program name. a second jpanel that shows 4 buttons

  Calculates the cost of a mortgage

Write a class called Mortgage that calculates the cost of a mortgage. Prompt the user to enter the principal amount, the term in years, and the interest rate per year.

  A client or server prepare to use udp in a java application

How does a client or server prepare to use UDP in a Java application? Are there any differences in what the client does and what the server does?

  The desired functionality is for your programs to input

the desired functionality is for your programs to input pairs of natural numbers as theyre entered by the user until

  What are the constraints on the argument values

What makes a program easy to modify and describe the order of magnitude of the following code section using Big(O) notation.

  Write an interface for an abstract method

Write an interface, PointingDevice, containing:  an abstract method, getXCoord that returns an int and an abstract method, getYCoord that returns an int.

  Class should have a method that returns the average

Write a class named TestScores. The class constructor should accept an array of test scores as its arguments. The class should have a method that returns the average of the test scores.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd