4. Create a class called Complex for performing arithmetic with complex numbers. Complex numbers have the form
Write a program to test your class. Use floating-point variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. Provide a no-argument constructor with default values in case no initializers are provided. Provide public methods that perform the following operations: a. Add two Complex numbers: The real parts are added together and the imaginary parts are added together. b. Subtract two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is subtracted from the imaginary part of the left operand. c. Print Complex numbers in the form (a, b), where a is the real part and b is the imaginary part. 5. Another abstract data type is the Queue, which is similar to a ‘waiting line’. Clients place items in a queue one at a time via an enqueue operation, then get them back one at a time via a dequeue operation. A Queue returns items in the first – in, first – out (FIFO) order, which means the first item inserted in a queue is the first item removed from the queue. Create a class called Queue, which encapsulates the above two methods. Your queue can be implemented using arrays. You can also overload the two methods for different data types. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en