Create a vector class implementing a number of vector

Assignment Help C/C++ Programming
Reference no: EM13939874

Create a Vector class implementing a number of vector operations as methods along with a testing program to verify the class is working.

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 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: EM13939874

Questions Cloud

Role of options and futures contracts : Examine the role of options and futures contracts in providing a hedge against risk in energy markets.
Investors in mortgage securities are subject : Investors in mortgage securities are subject to ____ risk.
Why municipal bonds have lower interests than treasury bonds : Which of the following best explains why municipal bonds have lower interests than Treasury bonds?
Authorised nurse immuniser in health promotion : Do you think the current methods are suitable for the socio-economic demographic of your area? Choose another student in your group and describe to them a health promotional tool that you feel may be of use in their local area. discuss the importa..
Create a vector class implementing a number of vector : Create a Vector class incorporating the following features
What is the feature of a corporate bond that protects : What is the feature of a corporate bond that protects the purchaser of the bond from moral hazard problems on the part of the borrower?
Creation of a strategic partnership : In 2003, with the blessing of both the British Prime Minister and the Russian President, BP and a group of Russian oligarchs announced the creation of a strategic partnership to hold their joint assets situated in Russia and Ukraine. This event wa..
Assume three binomial periods for one year call option : A stock that pays a 1% dividend is currently trading at $40. What is the borrowing amount (B) on the 1-year call option with strike price of $40 if the volatility of the underlying stock is 20% and the continuous risk-free rate is 4%? Assume three (3..
Tinco has product liability problems and has filed : TinCo has product liability problems and has filed for bankruptcy protection in the state court. Currently, its liabilities are $1 million, and its depreciable assets are valued at $550,000 (basis of $400,000).

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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