Consider the NRComplex class which represents a non-real complex number. In the class given below, r represents real part, and i represents imaginary part. For example, if r is 3 and i is 7, it...


Consider the NRComplex class which represents a non-real complex number. In the<br>class given below, r represents real part, and i represents imaginary part. For<br>example, if r is 3 and i is 7, it represents 3 + 7i. Because it represents a non-real<br>complex number, the imaginary part must not be 0.<br>public class NRComplex {<br>private double r;<br>private double i;<br>// Your code will be inserted here<br>

Extracted text: Consider the NRComplex class which represents a non-real complex number. In the class given below, r represents real part, and i represents imaginary part. For example, if r is 3 and i is 7, it represents 3 + 7i. Because it represents a non-real complex number, the imaginary part must not be 0. public class NRComplex { private double r; private double i; // Your code will be inserted here
Write a constructor that takes two doubles (for r and i). In case that i is null, the<br>constructor will throw an IllegalArgumentException exception with the message<br>i must be non-zero.<br>Notice that the constructor throws an exception (a run-time error) that appeared in a<br>Project 5. You do not need to understand in detail how exceptions works in Java for<br>answering this question.<br>

Extracted text: Write a constructor that takes two doubles (for r and i). In case that i is null, the constructor will throw an IllegalArgumentException exception with the message i must be non-zero. Notice that the constructor throws an exception (a run-time error) that appeared in a Project 5. You do not need to understand in detail how exceptions works in Java for answering this question.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here