CS150 -- Lab 3: Cramer's Rule



->Courses
->CS150
-->Homework
-->Lab 1
-->Lab 2
->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
-->Lab 7
->Electronic Submission
->Old Exams
->C++ Examples
->MSVC Info
->Software
->Tentative Schedule
->Course Policies

[Courses]
[Rich][Home][Rich]
[Author]

Fall Quarter 2000

Overview

In this lab, you will write a program to solve two simultaneous linear equations using Cramer's rule.

Acknowledgement

This laboratory assignment is based on an exercise from Program Development and Design Using C++, 2nd ed. by Gary Bronson.

Procedure

Engineers often need to solve simultaneous linear equations. Most engineers don't derive a lot of satisfaction from solving the equations by hand, so they would prefer to have a calculator or computer solve the equations for them. Cramer's rule is a technique for solving simultaneous linear equations. For the following set of two linear equations with two unknowns:

a1 X + b1 Y = c1
a2 X + b2 Y = c2

where a1, a2, b1, b2 c1, and c2 are constants and X and Y are the unknowns, Cramer's rule states that:

X = (c1 b2 - c2 b1) / (a1 b2 - a2 b1)
Y = (c2 a1 - c1 a2) / (a1 b2 - a2 b1)

Design, write, and test a computer program that prompts the user for six constants (a1, a2, b1, b2, c1, and c2) and displays the solution (X and Y) to the two linear equations represented by the input data.

Lab Report (due beginning of week 5 lab)

The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Purpose
  • Problem Statement
  • Procedure (include the steps in your design procedure, reasons for your design decisions, etc.)
  • Documented source code (you may wish to include this at the end of your report)
  • The results of your program given the following input: a1 = 3, a2 = 5, b1 = 4, b2 = 2, c1 = 40, and c2 = 34.
  • Conclusions (problems you encountered, what you learned, suggestions of how the lab could have been better, things you would have done differently, etc.)

Your report should be typed, and as with any report you submit, correct spelling and grammar are required. Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

Your grade will depend on quality of design and clarity of the code and documentation, as well as whether your program produces the correct results. If you have any questions, consult the instructor.

Office: CC-27C, Phone: 277-7339
Last Updated: September 10, 2000
© 2000 Dr. Christopher C. Taylor