
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
NOTE: Please don't Copy Paste from another question similar to this. I looked through them and nothing works properly. Please write in Python and C++ language this given code.

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- your goal is to modify your assignment 6 program to allow the user to pick up a random item and display a sorted list of the contents of the knap sack. note: if you use the built in c++, the most you can make on this assignment is 4 out of 10. you are expected to right your own sort based on one of the algorithms covered in class. your program should have the following: • the name of the program should be assignment 6. • 3 comment lines (description of the program, author, and date). • modify your assignment 5 program to do the following: o display a menu (use a switch statement to implement the menu) of actions ▪ attack: • for now, just display that the user chose to attack ▪ pick up item: • randomly add one of 6 items to an array named knapsack o you get to choose the item names • display which item the user picked up ▪ add an option to the main switch statement: display knap sack contents • the contents of the knap sack must be sorted The knapsack items are bananas, lays,…arrow_forwardMUST BE WRITTEN IN C++ Write a program so that user can use it to compute and display various statistics for a list of at least 3 values and up to 20 positive real values. The main objectives of this project are to work with menu, arrays, file input, and modules/functions. A menu is available and user can select one of the 4 options from the menu. The program will continue until option 4 is selected. For option 1, process a predefined array in the code with 3 values (73.3 83.4 58.0). User will be able to input an array from the keyboard with a sentinel loop with option 2. Use the following values (73.3 83.4 58.0 11.9 25.1 69.9 45.7 95.0 44.4)as one of your test cases (use-1.0 as a sentinel value). When option 3 is selected, input data from a text file. Use the given p2input.txt Download p2input.txt as a test case. The values in the file are shown below. 73.399.0 83.4 58.0 25.1 69.0 11.9 95.0 74.8 55.0 43.5 47.4 95.6 58.9 52.6 37.7 93.8 19.9 23.9 77.2 You can assume that the user will…arrow_forwardIt is often said that nothing in life is certain but death and taxes. For a programmer or data scientist, however, nothing is certain but encountering errors. In Python, there are two primary types of errors, both of which you are likely familiar with: syntax errors and exceptions. Syntax errors occur when the proper structure of the language is not followed, while exceptions are errors that occur during the execution of a program. These include errors such as ZeroDivision Error, TypeError, NameError, and many more! Under the hood, these errors are based in the concepts of object orientation, and all exceptions are class objects. If you're interested in more detailed explanations of the structure of exceptions as well as how to create your own, check out this article from the Python documentation! In the meantime, we'll implement our own version of an Error class. Complete the Error, SyntaxError, and ZeroDivisionError classes such that they create the correct messages when called. •…arrow_forward
- C++ ONLY PLEASE, and please read carefully, i have had people submit wrong answers Assignment 7 A: Rare Collection. We can make arrays of custom objects just like we’ve done with ints and strings. While it’s possible to make both 1D and 2D arrays of objects (and more), for this assignment we’ll start you out with just one dimensional arrays. Your parents have asked you to develop a program to help them organize the collection of rare CDs they currently have sitting in their car’s glove box. To do this, you will first create an AudioCD class. It should have the following private attributes. String cdTitle String[4] artists int releaseYear String genre float condition Your class should also have the following methods: Default Constructor: Initializes the five attributes to the following default values: ◦ cdTitle = “” ◦ artists = {“”, “”, “”, “”} ◦ releaseYear = 1980 ◦ genre = “” ◦ condition = 0.0 Overloaded Constructor: Initializes the five attributes based on values passed…arrow_forwardDiscuss the two different ways that a file may be opened inside of a C++ application. When might one approach be more appropriate than the other?arrow_forwardPlease us c++ to make the code thank you very much!arrow_forward
- How do you pass a file as a command line argument to a C++ program?arrow_forwardYou are given the source to an application which crashes when it is run. Afterrunning it ten times in a debugger, you find it never crashes in the same place. The application issingle threaded, and uses only the C standard library. What programming errors could be causingthis crash? How would you test each one?arrow_forwardHello, I am struggling with getting this DICE GAME to function properly. I have made an attempt to try and get the overall program to debug and run without errors, but to no avail. If I can get some help getting my PYTHON program to Run Correctly. #Lab 7-3 The Dice Game #add libraries needed playerTwo = 'NO NAME' playerOne = 'NO NAME' inputNames = ("enter name") import random #the main function def main(): print #initialize variables endProgram = "no" playerOne = "NO NAME" playerTwo = "NO NAME" #call to inputNames playerOne, playerTwo = inputNames(playerOne, playerTwo) #while loop to run program again while "endProgram" == 'no': #initialize variables p1number = 0 p2number = 0 winnerName = 'NO NAME' #call to rollDice winnerName = "rollDice"(p1number, p2number, playerOne, playerTwo, winnerName) #call to displayInfo displayInfo: ("winnerName") #end of while loop endProgram = "raw_input"('Do you want to end program?(Enter yes…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education