Question: 2 Consider the Vector 2 D class. We want to add multiplication methods in this class. If a vector is multiplied by a real number,
Consider the VectorD class.
We want to add multiplication methods in this class. If a vector is multiplied by a real number, then
both and values are simply multiplied by that real number. If it is multiplied by another vector
then it will follow the rule of dot product. Dot product of two vectors &
u Y y In this VectorD class, write two overloaded methods for multiplication;
A One method takes a double parameter, does the real number multiplication, then returns a
Vector object and
B The other one takes a VectorD parameter, does the dot product and then returns a double
number.
public class VectorD
double ;
VectorD
;
;
VectorDdouble double y
this. ;
this. i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
