Sequence of method in vector class

Assignment Help JAVA Programming
Reference no: EM1379121

Construct a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.
1. Construct 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 produce method have size 3, ie < i, j, k >
j. some of the methods should be 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: EM1379121

Questions Cloud

Java script program for song : Construct a JavaScript program that declares and prints an array that includes at least twenty of your favorite songs.
Construct java program named collegelist : Construct a set of classes for a college to use in many student service and personnel applications. Classes you require to design include following:
Elements from a html document : Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.
Fixing errors in a java program : You coded the following on line ten of the class MyApplet.java:
Sequence of method in vector class : Construct a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.
Java program to find a value at in index : Construct a main class named Array Program that generates an array of 50-integers, all ranging from one to one hundred.
Discuss primary financial statements : Discuss primary financial statements published by a corporation, the various classifications used in a balance sheet-What is the purpose of a Balance Sheet? What information does it provide?
Java program for creating a order menu : Assume your consulting company has been hired to construct a program that meets the following requirements.
Market entry cultural report : Market Entry Cultural Report - the reasons for your country of choice and the market entry strategy you recommend

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java program to write-read data from user using i-o function

Write java program to write and read data from user using I/O functions. Describe class with data members name[20],emp_id,basic pay,net pay.calculate all the allowances.

  Java program for creating a order menu

Assume your consulting company has been hired to construct a program that meets the following requirements.

  Define private instance variable to hold boolean value

Write a Java Enumeration "LetterGrade" that represents letter grades A through F including plus and minus grades. Define a private instance variable to hold a boolean value.

  Compilation and Execution - JAVA problem

Style marks are based on how your submitted code looks. Remember that good code is easily readable (and understandable) by someone who did not write it. For assignments, you should also include your name, student number, what course this is, what ass..

  Java program ask user to enter 10-character telephone number

Write a Java program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The program should display the telephone number with any alphabetic characters

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Solving programming problems

Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Implement the finite field gf

Write a program called "GF2.java" to implement the finite field GF(p n )where p is a prime number andn is a positive integer.You also need to write four methodsto realize.

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Write a program that shows the current time and date

Write a program that shows the current time and date

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