Alefas / complex-task

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Task

  1. Checkout Project (In case if you need project stub)
  2. Implement in YourNameComplex.scala file
  3. Send it by e-mail: course.scala@gmail.com
  4. Deadline is 27 September 2012, 21:00

Task details

Implement case class Complex(re: Double, im: Double).

  1. It should contain following operators: +, -, *, /, unary_+, unary_-, ^. Override toString method.
  2. Complex companion should contain I constant. And possibility to write code like Re(z), Im(z). Also add methods conjugation, sqrt, abs.
  3. Add auxiliary constructor from String.
  4. It should be possible to use all operators with other numeric types on the left and on the right side.
  5. Note that for every task part you can write code with any implementation and complexity (like two sqrt values or one). All of this is up to you.

About