Quadratic Equation

C# – Object Oriented Programming – Lab 1 (Roots of a quadratic equation)

So I thought I’d upload some of the C# Object Oriented Programming labs I was given in my Computer Games studies and my solutions for them. Here’s the first one:

Create a Windows Console application, with a number of variables:
a, b c (floats)
x1 and x2 (floats)
hasRoots (boolean)

The purpose of the program is to calculate the roots of the quadratic equation using the quadratic formula:

Here’s my solution for it:

Continue reading