Define method

Report a typo

Write the scalar product operator (*) for the Vector class. The following code must work:

Vector2(2, 6) * Vector2(5, -1) // 4.0

Sample Input 1:

Vector2(2, 6)
Vector2(5, -1)

Sample Output 1:

4.0
Write a program in Scala 3
class Vector2(val x: Double, val y: Double):
/* your code */
___

Create a free account to access the full topic