course.wilkes.edu/CS125Labs
Welcome to the site for CS 125 labs!

 

Hands On C++: Project 2

Prev | Next | Lab 2

Objectives

1. Gain further experience constructing expressions.
2. Gain further experience writing programs.

Introduction

Each of the following projects involves the construction of expressions of various types, and so will provide practice in building expressions. Your instructor will tell you which one to do.

Projects

2.1. Finish the lab exercise by completing the remaining experiments.

2.2. Write a program that finds the resistance of an electronic circuit with three parallel resistors resistor1, resistor2, and resistor3. The resistance can be computed using the following formula:

                                   1
   resistance = -------------------------------------- 
                      1            1            1
                 ---------- + ---------- + ----------
                 resistor1    resistor2    resistor3

2.3. Using the ^ as an exponentiation operator (which it is not in C++), the two solutions of a quadratic equation

   y = ax^2 + bx + c
can be found using the quadratic formula:
   solution1 = -b + the square root of (b^2 - 4ac)
               -----------------------------------
                              2a
and
   solution2 = -b - the square root of (b^2 - 4ac)
               -----------------------------------
                              2a
Write a program that inputs values for a, b and c, and outputs the values of solution1 and solution2. Use boolean expressions and the assert() mechanism to ensure that
  • a is not zero, and
  • the expression (b^2 - 4ac) is not negative.

2.4. Write a program that, given the amount of a purchase and the amount received in payment, computes the change in dollars, half-dollars, quarters, dimes, nickels and pennies.

Don't forget to clean up your directory when you are all finished...

Prev | Next | Lab 2

 
  Home

Help

Lab 0

Lab 1

Lab 2

Lab 3a

Lab 3b

Lab 4

Lab 5

Lab 6

Lab 7

Lab 8

Lab 9

Lab 10

Lab 11

Lab 12

Lab 13



Membership

Login




Last update: Tuesday, August 22, 2000 at 1:06:47 PM.
visitors to this page.