/* You have to use the following template to submit to Revel. Note: To test the code using the CheckExerciseTool, you will submit entire code. To submit your code to Revel, you must only submit the code enclosed between // BEGIN REVEL SUBMISSION // END REVEL SUBMISSION */ import java.util.Scanner; public class Exercise13_17 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the first complex number: "); double a = input.nextDouble(); double b = input.nextDouble(); Complex c1 = new Complex(a, b); System.out.print("Enter the second complex number: "); double c = input.nextDouble(); double d = input.nextDouble(); Complex c2 = new Complex(c, d); System.out.println("(" + c1 + ")" + " + " + "(" + c2 + ")" + " = " + c1.add(c2)); System.out.println("(" + c1 + ")" + " - " + "(" + c2 + ")" + " = " + c1.subtract(c2)); System.out.println("(" + c1 + ")" + " * " + "(" + c2 + ")" + " = " + c1.multiply(c2)); System.out.println("(" + c1 + ")" + " / " + "(" + c2 + ")" + " = " + c1.divide(c2)); System.out.println("|" + c1 + "| = " + c1.abs()); Complex c3 = (Complex)c1.clone(); System.out.println(c1 == c3); System.out.println(c3.getRealPart()); System.out.println(c3.getImaginaryPart()); Complex c4 = new Complex(4, -0.5); Complex[] list = {c1, c2, c3, c4}; java.util.Arrays.sort(list); System.out.println(java.util.Arrays.toString(list)); } } // BEGIN REVEL SUBMISSION class Complex implements Cloneable, Comparable { private double a; private double b; // Write your code } // END REVEL SUBMISSION