## Project 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(s) to do.

### Projects

Projects 2.1-2.4 are from Chapter 3 of the textbook *Programming in C++ for
Engineering and Science*.
**2.1**. Programming Problem 1 (converting measurements) at the
end of Chapter 3.

**2.2**. Programming Problem 2 (converting weights) at the
end of Chapter 3.

**2.3**. Programming Problem 3 (resistance in an electronic circuit
— series connection) at the end of Chapter 3.

**2.4**. Programming Problem 4 (resistance in an electronic circuit
— parallel connection) at the end of Chapter 3.

**2.5**. 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*. (Don't
worry now about "division by 0" or "square root
of a negative number" errors. We'll see how to handle these later.)

**2.6** 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.

Back to the Lab Exercise

Back to This Lab's Home Page

Report errors to Larry Nyhoff
(nyhl@cs.calvin.edu)