 C# – Object Oriented Programming – Lab 2 (Equation of a Line)

The equation of a line is given as: y = mx +c. Write a program that asks the user for the start and end points of a line and calculates values for m and c:

m = The slope of the line (y2 – y1) / (x2 – x1)
c = The intercept (where the line intersects the y axis (i.e. Where x = 0)

Here’s my solution for it: 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:

Lab1
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:

Like a bat out of hell..

It’s here! A kicking screaming blog-page.
I’ll be using this blog to share thoughts, insights and general ramblings on creative projects, game design & development, Unity, C# and life in general.

Hope it comes in useful, enjoy!