These are the additional exercises not printed in the text. These exercises are available
only to the instructors. Solutions for these exercises are named with suffix Extra (e.g.,
Exercise01_01Extra) and can be downloaded along with all other programming exercises
by the instructors from the IR Website. When you download the solutions for
programming exercises, the zip file also contains the solutions for extra exercises.
Extra Exercise for Chapter 1
*1.1 (Simple computation) The formula for computing the
discriminant of a quadratic equation
is b^2 –
4ac. Write a program that computes the discriminant for
the equation 3x^2 + 4x + 5 = 0.
*1.2 (Physics: acceleration) Average acceleration is
defined as the change of velocity divided by the time taken
to make the change, as shown in the following formula:
Here, v0 is the starting velocity in meters/second, v1 is
the ending velocity in meters/second, and t is the time
span in seconds. Assume v0 is 5.6, v1 is 10.5, and t is
0.5, and displays the average acceleration.
*1.3 (Display pattern) Write a program that displays the
following a big sign for 100 as shown in the sample run:
Extra Exercise for Chapter 2
*2.1 (Rectangle perimeter, area, and diagonal length) Write
a program that prompts the user to enter the width and
height of a rectangle and displays the perimeter, area, and
the length of diagonal. Here is a sample run:
<output>