Ask a question from expert

Ask now

Assignment CISP400 Object Oriented Programming with C++

11 Pages3830 Words198 Views
   

Object Oriented Programming with C++ (CISP400)

   

Added on  2019-10-09

Assignment CISP400 Object Oriented Programming with C++

   

Object Oriented Programming with C++ (CISP400)

   Added on 2019-10-09

BookmarkShareRelated Documents
You can choose to submit either A5 (worth 150 points), AD5 (worth 180), or both (worth 180) for 5th assignment you will get a score for this assignment either 150 points base or 180 points base. Grading Criteria:1.If the submitted program cannot be compiled or run on a Microsoft visual studio 2013 C++ compiler, the assignment will not get any credit.2.If the file name does not follow the naming instruction as stated in syllabus, the assignment will get 5 to 15 points deduction. 3.If the header section of the submitted file does not include personal information and purpose of the file, the assignment will get 5 to 30 points deduction.4.Late assignments will not get any credit for the assignment. 5.A submission does not follow the instructions of the assignment will get little credit.6.A portion of the assignment is not finished or incomplete will get little or no credit.7.Submit an assignment to a wrong drop box. The wrong drop box one will not get any credit.8.If use A for AD or AD for A assignments in the file name, the student will not get any credit for the assignments. 9.If the submitted file(s) cannot be opened by the instructor’s software (WinZip, Visual Studio, or text editor) the assignment will have little credit.10.If the submission file does not include all necessary programming files to run the program, the program will get little credit.11.If the program does not separate into several files (driver, header file, implementation file, etc.) as describe in the assignment, the program will get little credit.Page 1 of 11CISP400V9A5
Assignment CISP400 Object Oriented Programming with C++_1
12.If the displaying result of the program is not exactly match with the graphic in the assignment description or the displaying result of the executable file which comes with the assignment, the assignment will get little credit. 13.If the program does not have enough detail documentation in the programming area the program will get 5 to 30 points deduction.14.If the program includes some unrelated documentation the program will get some points deduction.A5Consider class Complex shown in Figs. 10.14–10.16(attached). The class enables operations on so called complex numbers. These are numbers of the form realPart + imaginaryPart * i, where i has the value of square root -1The following are requirement for this assignment.a). Modify the class to enable input and output of complex numbers through the overloaded >> and << operators, respectively. The “<<” operator provides print ability. So the print function inthe original Complex class can be removed. The “>>” operator provides the ability to change theprivate data members of the Complex class object. b). Overload the multiplication operator to enable multiplication of two complex numbers as in algebra.c). Overload the division operator to enable division of two complex numbers as in algebra. In here we need handle “divide by zero” situation.d). Overload the == and != operators to allow comparisons of complex numbers.e).Overload the = operator to allow assign a Complex object to the other Complex object. f) Create CISP400V9A5.cpp to test all the functions designed in the assignment.Page 2 of 11CISP400V9A5
Assignment CISP400 Object Oriented Programming with C++_2
The following is an explanation on the complex number calculation.1.Adding two complex numbers. The real parts are added together and the imaginary partsare added together. So, if we have (a + bi) + (c + di)), the result should be (a + c) + (b + d) i.2.Subtracting 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. So, if we have (a + bi) - (c + di)), the result should be (a - c) + (b - d) i.3.Multiplying two complex numbers. The real part of the result is the real part of the right operand multiplies the real part of the left operand minus the imaginary part of the right operand multiply the imaginary part of the left operand. The imaginary part of the result is the real part of the left operand multiply the imaginary part of the left operand plus the imaginary part of the left operand multiply the real part of the right operand. So, if we have (a + bi) * (c + di)), the result should be (ac - bd) + (ad + bc) i.4.Dividing two complex numbers. We set the value of square real part of the denominator plus square imaginary part of the denominator is A. The real part of the result is the real part of the numerator multiplies the real part of the denominator plus the imaginary part of the numerator multiply the imaginary part of the denominator and divided by A. The imaginary part of the result is the real part of the left operand multiply the imaginary part of the left operand plus the imaginary part of the left operand multiply the real part of the right operand. So, if we have (a + bi) / (c + di)), the result should be (ac+bd)+i(bc-ad))/(c2+d2).If you have question regarding the calculation of complex numbers you can refer to Complex numbers.doc file which is attached with this assignment. Or you can search the internet for information.CISP400V9A5.cppIn CISP400V9A5.cpp we need to do the followingPage 3 of 11CISP400V9A5
Assignment CISP400 Object Oriented Programming with C++_3
1.Instantiate 6 Complex objects ( x, y( 4.3, 8.2 ), z( 3.3, 1.1 ), k, l, and m(0, 0.1)).2.Use “cin >> k:” statement to provide k object data. 3.Display all the object data by using “cout << "\nx: " << x << "\ny: " << y << "\nz: " << z << "\nk: " << k << "\nl: " << l << "\nm: " << m << '\n';”4.Use “x = y + z;” statement to demonstrate overloading + and = operators. And use “cout << "\nx = y + z:\n" << x << " = " << y << " + " << z << '\n';” statement to display the result.5.Use “x = y - z;” statement to demonstrate overloading - and = operators. And use “cout << "\nx = y - z:\n" << x << " = " << y << " - " << z << '\n';” statement to display the result.6.Use “x = y * z;” statement to demonstrate overloading * and = operators. And use “cout << "\nx = y * z:\n" << x << " = " << y << " * " << z << '\n';” statement to display the result.7.Use “x = y / z;” statement to demonstrate overloading / and = operators. And use “cout << "\nx = y / z:\n" << x << " = " << y << " / " << z << '\n';” statement to display the result.8.Use “x = y / l;” statement to demonstrate overloading / and = operators. And use “cout << "\nx = y / l:\n" << x << " = " << y << " / " << l << '\n';” statement to display the result. This is a divide by zero situation.9.Use “x = y / m;” statement to demonstrate overloading / and = operators. And use “cout << "\nx = y / m:\n" << x << " = " << y << " / " << m << '\n';” statement to display the result. This is a divide by a close to zero situation.10.Use “if ( x != k ) cout << x << " != " << k << '\n';” statement to demonstrate overloading ! = operator and to display the result.11.Use “x = k;” statement to demonstrate overloading = operator.Page 4 of 11CISP400V9A5
Assignment CISP400 Object Oriented Programming with C++_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
CISP400 Object Oriented Programming with C++ Assignment
|10
|2009
|76

Object Oriented Programming with C++ CISP400
|10
|3182
|386

CISP400 Assignment Object Oriented Programming with C++
|11
|3728
|429

Assignment on CISP400 Object Oriented Programming with C++
|6
|2031
|364

CISP400 Object Oriented Programming with C++
|12
|2105
|260