Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 19, Problem 19.11PE
Program Plan Intro

ComplexMatrix

Program Plan:

  • Include a class name named “Exercise19_11”.
    • Declare util package.
    • Declare main method.
      • Define the matrices “arr1” and “arr2” using the class “Complex”.
      • Using “for” loop, generate values into arrays.
      • Add and multiply the matrices and multiply the matrices using “GenericMatrix” class.
    • Define the method named “removeDuplicates”.
      • Define the object “ans” for “ArrayList” class.
      • Using condition, check the duplicate values in arrays and return the result.
  • Include a class name named “ComplexMatrix” which extends the “GenericMatrix”.
    • Define the method named “add()” which add two matrices and return the resultant value.
    • Define the method named “multiply()” which multiplies two matrices and return the resultant value.
    • Define the method named “zero()” which fills “0” to matrices.
  • Include an abstract class name named “GenericMatrix”.
    • Declare the methods “add”, “multiply”, and “zero” with generic object “E”.
    • Define all the methods with their arguments.
    • Define “printResult()” method to print the resultant values on screen.
  • Include a class name named “Complex”.
    • Declare package.
    • Declare main method.
    • Declare double variables “a” and “b”.
    • Declare Constructors that creates a complex object for number 0.
    • Declare a constructor that creates a complex object with 0 for b.
    • Declare a constructor that creates a complex object with specified a and b.
    • Declare a method to return real part of complex number.
    • Declare a method to return imaginary part of complex number.
    • Declare a method to add a complex number to this complex number.
    • Create a method to subtract a complex number from this complex number.
    • Create a method to multiply a complex number by this complex number.
    • Create a method to divide a complex number by this complex number.
    • Create a method that returns the absolute value of this complex number.
    • The protected clone method defined in the Object class is overridden, its accessibility is strengthened.
    • Close the main method.

Blurred answer
Students have asked these similar questions
(Tic-Tac-Toe) Write a program that allows two players to play the tic-tac-toe game. Your program must contain the class ticTacToe to implement a ticTacToe object. Include a 3-by-3 two-dimensional array, as a private member variable, to create the board. If needed, include additional member variables. Some of the operations on a ticTacToe object are printing the current board, getting a move, checking if a move is valid, and determining the winner after each move. Add additional operations as needed.
I would really appreciate it if you could solve it quickly. Thank you so much  C++
The following describes the difference between void and NULL pointers: Make proper use of examples to bolster your argument.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning