Question: Part I Create a Scala class called Complex that represents the complex numbers. The following cases must be passed. scala> val a = new Complex(5.0,

Part I Create a Scala class called Complex that represents the complex numbers. The following cases must be passed. scala> val a = new Complex(5.0, 6.0) val a: Complex = 5.0 + 6.0i scala> val b = new Complex(-3.0, 4.0) val b: Complex = -3.0 + 4.0i scala> val c = new Complex(8.0) val c: Complex = 8.0 scala> a.real val res0: Double = 5.0 scala> b.imaginary val res1: Double = 4.0 scala> b + a val res2: Complex = 2.0 + 10.0i scala> b + 2.0 val res3: Complex = -1.0 + 4.0i scala> a - b val res4: Complex = 8.0 + 2.0i scala> a * b val res5: Complex = -39.0 + 2.0i scala> b * a val res6: Complex = -39.0 + 2.0i Just TWO scala files TWO seprate scala file [rpjects scala> b * 2.0 val res7: Complex = -6.0 + 8.0i scala> a / b val res8: Complex = 0.36 - 1.52i scala> a / b * b val res9: Complex = 5.0 + 6.0i scala> a.conjugate val res10: Complex = 5.0 - 6.0i scala> a.reciprocal val res11: Complex = 0.08196721311475409 - 0.09836065573770492i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!