Please write your original code in c++ Thank you Objective Create a class named Complex to represent complex numbers. Use the main() function and create at least three complex number objects and test all member functions of the Complex class. How to use classes. Related SLO Develop properly structured multifile programs with automatic compilation. Use classes in C++. Instructions Create a program named LastnameFirstname18.cpp, that does the following: Note: This program has no user input. Define a class called Complex that will represent a complex number. Complex numbers have the form a + bi, where a is the real part and b is the imaginary part. Both the a and b coefficients are real numbers. i is the square root of negative one, but it's not actually implemented in code. For this assignment, you will only be working with a and b. Wikipedia page for Complex numbers: here Declare 2 private double data members: real and imaginary Define one default constructor that initializes real and imaginary to 0. Note: A default constructor is a constructor with no parameters. Define a member function called print that uses cout to print the complex number in the format (a + bi) followed by a newline. This function has no parameters. Include the parenthesis symbols in the print out. If the imaginary part is negative (less than 0), print in the format (a - bi) followed by a newline. For example, if real is 6 and imaginary is -3, the output should look like this: (6 - 3i) It should not look like (6 - -3i) or (6 -3i) or (6-3i) Define a member function called set that sets both the real and imaginary data members. This function has 2 double parameters, one for each data member. Assign the real and imaginary data members respectively. Define two get functions, one for each data member, getReal() and getImaginary() that returns its respective data member. Any member function that does not inheritely modify the data members are defined with the const keyword to prevent data members from being modified in the function. For example, the print function does not modify the data members, so the header of the print should look like this: void print() const { Use my main() to test the your member functions: https://laulima.hawaii.edu/x/8s55cE There should be no errors present. If the spacing is off, then you may be missing a newline at the end of your print() function. Be sure to have a program description at the top and in-line comments. Be clear with your comments and output to the user, so I can understand what the program is doing. Comments are not required in main() if you used the provided one. See the commented version of the functions.cpp to see how to comment your member functions. Be sure to have read through the assignment policy for this class.
Please write your original code in c++ Thank you Objective Create a class named Complex to represent complex numbers. Use the main() function and create at least three complex number objects and test all member functions of the Complex class. How to use classes. Related SLO Develop properly structured multifile programs with automatic compilation. Use classes in C++. Instructions Create a program named LastnameFirstname18.cpp, that does the following: Note: This program has no user input. Define a class called Complex that will represent a complex number. Complex numbers have the form a + bi, where a is the real part and b is the imaginary part. Both the a and b coefficients are real numbers. i is the square root of negative one, but it's not actually implemented in code. For this assignment, you will only be working with a and b. Wikipedia page for Complex numbers: here Declare 2 private double data members: real and imaginary Define one default constructor that initializes real and imaginary to 0. Note: A default constructor is a constructor with no parameters. Define a member function called print that uses cout to print the complex number in the format (a + bi) followed by a newline. This function has no parameters. Include the parenthesis symbols in the print out. If the imaginary part is negative (less than 0), print in the format (a - bi) followed by a newline. For example, if real is 6 and imaginary is -3, the output should look like this: (6 - 3i) It should not look like (6 - -3i) or (6 -3i) or (6-3i) Define a member function called set that sets both the real and imaginary data members. This function has 2 double parameters, one for each data member. Assign the real and imaginary data members respectively. Define two get functions, one for each data member, getReal() and getImaginary() that returns its respective data member. Any member function that does not inheritely modify the data members are defined with the const keyword to prevent data members from being modified in the function. For example, the print function does not modify the data members, so the header of the print should look like this: void print() const { Use my main() to test the your member functions: https://laulima.hawaii.edu/x/8s55cE There should be no errors present. If the spacing is off, then you may be missing a newline at the end of your print() function. Be sure to have a program description at the top and in-line comments. Be clear with your comments and output to the user, so I can understand what the program is doing. Comments are not required in main() if you used the provided one. See the commented version of the functions.cpp to see how to comment your member functions. Be sure to have read through the assignment policy for this class.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please write your original code in c++ Thank you
- Objective
- Create a class named Complex to represent complex numbers. Use the main() function and create at least three complex number objects and test all member functions of the Complex class.
- How to use classes.
- Related SLO
- Develop properly structured multifile programs with automatic compilation.
- Use classes in C++.
- Instructions
- Create a
program named LastnameFirstname18.cpp, that does the following: - Note: This program has no user input.
- Define a class called Complex that will represent a complex number.
- Complex numbers have the form a + bi, where a is the real part and b is the imaginary part. Both the a and b coefficients are real numbers. i is the square root of negative one, but it's not actually implemented in code. For this assignment, you will only be working with a and b.
- Wikipedia page for Complex numbers: here
- Declare 2 private double data members: real and imaginary
- Define one default constructor that initializes real and imaginary to 0.
- Note: A default constructor is a constructor with no parameters.
- Define a member function called print that uses cout to print the complex number in the format (a + bi) followed by a newline.
- This function has no parameters.
- Include the parenthesis symbols in the print out.
- If the imaginary part is negative (less than 0), print in the format (a - bi) followed by a newline.
- For example, if real is 6 and imaginary is -3, the output should look like this: (6 - 3i)
- It should not look like (6 - -3i) or (6 -3i) or (6-3i)
- Define a member function called set that sets both the real and imaginary data members.
- This function has 2 double parameters, one for each data member.
- Assign the real and imaginary data members respectively.
- Define two get functions, one for each data member, getReal() and getImaginary() that returns its respective data member.
- Any member function that does not inheritely modify the data members are defined with the const keyword to prevent data members from being modified in the function.
- For example, the print function does not modify the data members, so the header of the print should look like this:
void print() const {
- For example, the print function does not modify the data members, so the header of the print should look like this:
- Use my main() to test the your member functions: https://laulima.hawaii.edu/x/8s55cE
There should be no errors present. If the spacing is off, then you may be missing a newline at the end of your print() function. - Be sure to have a program description at the top and in-line comments.
- Be clear with your comments and output to the user, so I can understand what the program is doing.
- Comments are not required in main() if you used the provided one.
- See the commented version of the functions.cpp to see how to comment your member functions.
- Be sure to have read through the assignment policy for this class.
- Create a
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 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.Recommended textbooks for you
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
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