COSC 3353 Programming Assignment 2

Scheme

Purpose: This assignment uses Scheme to solve the quadratic equation

Due: Beginning of class on February 11. There will be a code review on this assignment, therefore submissions received late will not be accepted.

Requirements: This is an individual assignment. You may not work with other class members or share code. All code is to be written by the individual student and may not be downloaded from the Internet or other sources. Do the following:

You will need to write a series of procedures for this assignment to solve the quadratic equation (aX^2 + bX + c = 0). There is a formula that will give you the two answers to this equation. Some solutions give answers that are imaginary, which are well handled in Scheme. Your solution should give a comprehensive answer to all of the possible solutions as follows:

• root1 (the + root)
• root2 (the - root)
• root-largest (the largest of the two roots)
• root-smallest (the smallest of the two roots)
• discriminate (returns only the value of the discriminate (b^2 - 4ac) before the square root is taken.
• roots-real? (#t if true, #f if the roots are complex)
• roots-complex? (#t if true, #f if the roots are not complex)
• roots-equal? (#t if true, #f if the roots are not equal)

Scheme has a sqrt procedure.

Scheme provides both a real? and complex? procedures that you can use. Both return a Boolean or you can write your own procedures.

Write a comprehensive series of test cases that test all cases and demonstrate that they work properly, including showing that easily factored values that give integer solutions. Show in your output that each of these test cases works properly.

Make sure your code is well documented.

Help: I will be available during office hours to provide assistance with this program and in using Scheme.

Grading Criteria. Submit your text file as an attachment to an email to me. The subject line should be COSC 3353, Assignment 2, Your Name.

Grading Criteria: 100 points available for this programming assignment.