CS 205 - Programming for the Sciences
Spring 2008 - Programming Assignment 1

20 points


Out: January 17, 2008
Due: January 24, 2008


Assignment

The roots of a quadratic equation of the form ax2 + bx + c where a, b, and c are integer coefficients may be computed using the following equations:


and


The number and type of the roots depends on the value of b2-4ac, called the discriminant. There are three possibilities:


discriminant > 0

two real roots, one from each equation

discriminant = 0

one real root, both equations give same root

discriminant < 0

two complex roots, one from each equation


Write a C# Windows Application program that will accept the coefficients a, b, and c in textboxes, and display the number and type of the roots of the resulting quadratic equation and the values of those roots when a button is clicked. For the complex roots, display the value in the form x+yi where x is the real part (-b), y is the magnitude of the imaginary part (4ac-b2), and i represents the square root of -1. Programming notes and an example GUI showing how this might look is given below.


What to submit

For full credit, a compressed (zipped) solution folder containing a C# project must be submitted as an attachment to an email to Dr. Hwang (hwang@evansville.edu) no later than 4:30pm on the due date.


To create a compressed solution folder find the solution folder via Windows Explorer. Right-click on the solution folder, select Send To, then select Compressed (zipped) folder. This will created a compressed folder of the same name as the solution folder with extension .zip and an icon of a folder with a zipper.


Programming notes:

GUI notes

The GUI interface of the program might look like the following for each possible result:







Typos fixed 01/17/08 2