Write a class that will allow for the addition

Assignment Help Computer Engineering
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

Reference no: EM132175550

Questions Cloud

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?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd