Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Y3

 

Complex number class
Design a class in C++, Java, and Python that represents complex numbers and supports important operations such as
addition, subtraction, multiplication and division. For the C++ and Python versions you will need to implement the
following functions for each operation:
• op: Complex x Complex → Complex
• op: Complex x double → Complex
• op: double x Complex → Complex
Where op is one of +, -, *, or /. In addition, you will need to overload the stream insertion operator << to print objects of
this type.
A constructor must be defined as well as overloading the assignment operator to allow for implicit conversion from
doubles to Complex. Any other methods you deem appropriate should also be included. The more complete your class
the better.
The Java version will not have as many methods because Java does not allow for operator overloading or friend
functions. Again, the more complete your Java class the better. Override the toString() method.
The Python version you should also include functions for converting from complexes to strings.
The required files for this project are: a complex.h file that contains the declaration of the complex class, a complex.ce
file that contains the implementations of method and functions declared in the complex class, a main.cc that
instantiates complex numbers and tests all methods and functions, a Complex.java file that is the Java implementation,
and a Main.java file that instantiates and tests all methods of the Complex class. The python files required are a main.py
file.
In addition you must write a 2.5 (625+ words) page paper comparing and contrasting the C++, Java, and Python ways of
implementing such a class (hint: operator overloading). Comment on the pros and cons of all languages and finally make
a determination as to which language is superior. Submit the file as "complex.txt".
Transcribed Image Text:Complex number class Design a class in C++, Java, and Python that represents complex numbers and supports important operations such as addition, subtraction, multiplication and division. For the C++ and Python versions you will need to implement the following functions for each operation: • op: Complex x Complex → Complex • op: Complex x double → Complex • op: double x Complex → Complex Where op is one of +, -, *, or /. In addition, you will need to overload the stream insertion operator << to print objects of this type. A constructor must be defined as well as overloading the assignment operator to allow for implicit conversion from doubles to Complex. Any other methods you deem appropriate should also be included. The more complete your class the better. The Java version will not have as many methods because Java does not allow for operator overloading or friend functions. Again, the more complete your Java class the better. Override the toString() method. The Python version you should also include functions for converting from complexes to strings. The required files for this project are: a complex.h file that contains the declaration of the complex class, a complex.ce file that contains the implementations of method and functions declared in the complex class, a main.cc that instantiates complex numbers and tests all methods and functions, a Complex.java file that is the Java implementation, and a Main.java file that instantiates and tests all methods of the Complex class. The python files required are a main.py file. In addition you must write a 2.5 (625+ words) page paper comparing and contrasting the C++, Java, and Python ways of implementing such a class (hint: operator overloading). Comment on the pros and cons of all languages and finally make a determination as to which language is superior. Submit the file as "complex.txt".
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY