Reference no: EM132175550
Using Using C# and visual Studio, Write a class that will allow for the addition, subtraction, multiplication and division of 2 complex numbers.
The class must use operator overloading for +, -, * and / operations.
The class must have a ToString method that overrides the ToString method of the object class and properly formats the complex number ( 3.4 + 2i or -2.1 ? 1.5i). You may use the following as a starting point for your class:
public class ComplexNumbers
{
public double Real
{
get ;
private set;
}
public double Imag
{
get ;
private set;
}
public ComplexNumbers(double r, double i)
{
Real = r;
Imag = i;
}
public static ComplexNumbers operator +(ComplexNumbers lhs, ComplexNumbers rhs)
{
double r = lhs.Real + rhs.Real;
double i = lhs.Imag + rhs.Imag;
return new ComplexNumbers(r, i);
}
Your console application to demonstrate the class's functioning must read the complex number components from a file called data.txt, add the first 2 complex numbers, subtract the next 2, multiply the next 2 and divide the last 2 and then write the results both to the screen and a file called outData.txt.
Screen output should be properly formatted with the appropriate signs and the i for imaginary. The file output should be structured in the same manner as data.txt is formatted, with just the components. data.txt has the following contents and structure.
The first value is the real component and the second is the imaginary component.
2 4
1.5 -3
2.3 -1.1
-1.8 2.5
3 5
7 -1
3 3
1 -2
Role as a professional helper
: How might the same experiences with your family influence your role as a professional helper, positively and/or negatively?
|
List the details of the files in your directory
: List the details of the files in your directory. List the details of the files in your parent directory.
|
What is the speed at its closest point
: Two meteoroids are heading for earth. Their speeds as they cross the moon's orbit are 2.0 km/s. . The first meteoroid is heading straight for earth.
|
What is the moment of inertia of disk
: Two disks are rotating about the same axis. Disk A has a moment of inertia of 5.28 kg·m2 and an angular velocity of +4.29 rad/s. Disk B is rotating.
|
Write a class that will allow for the addition
: Using Using C# and visual Studio, Write a class that will allow for the addition, subtraction, multiplication and division of 2 complex numbers.
|
What is the change in total kinetic energy of the two skater
: Two ice skaters, Daniel (mass 60.0 kg) and Rebecca (mass 45.0 kg), are practicing. Daniel stops to tie his shoelace and, while at rest, is struck by Rebecca.
|
What are the diameters of the disks
: Two identical closely spaced circular disks form a parallel-plate capacitor. Transferring 2.9×109 electrons from one disk to the other causes the electric field
|
How much force does the atmosphere exert on the flat
: Two cylinders each with a 60 cm diameter, thatare closed at one end, open at the other, are joined to form asingle cylinder, then the air inside is removed.
|
Dramaturgical approach to social interaction
: Erving Goffman's dramaturgical approach to social interaction implies that we are all actors who perform for an audience. Do you agree with this view?
|