Code Monkey home page Code Monkey logo

complex-number-class's Introduction

Complex-Number-Class

Designed and implemented a class in Java, C++, and Python that represents complex numbers. The class supports important operations in addition, subtraction, multiplication and division.

For the C++ and Python versions I implemented the following functions for each operation. In these functions op is one of +, -, *, or / :

op: Complex × Complex → Complex

op: Complex × double → Complex

op: double × Complex → Complex

I defined a constructor as well as overloaded the assignment operator so these versions can perform implicit conversions from doubles to Complex. The stream insertion operator << has also been overloaded to print objects of the proper type. In addition, the Python version contains functions that allow conversion from complexes to strings.

Since the Java lanaguage does not allow operator overloading/ friend functions, the Java version does not include as many functions as the prior two. However, overrode the toString() method in this version.

This repository includes:

-a Complex.java file that is the Java implementation

-a Main.java file that instantiates and tests all methods of the Complex class

-a complex.h file that contains the declaration of the complex class

-a complex.cc 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.py file.

MainExample.java, mainExample.cc, rational.cc, rational.h, and rational.py were all used as example files.

complex-number-class's People

Contributors

ajs424 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.