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.
These extra are set up in CheckExercise and LiveLab named Exercise01_01Extra, etc.
Extra Exercise for Chapter 1
*1.1 (Simple computation) The formula for computing the discriminant of a quadratic equation
2
ax bx c + + = 0
is b^2 – 4ac. Write a program that computes the discriminant for the equation 3x^2 + 4x
+ 5.
*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:
1 0 v v
a
t
−
=
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 write the code to display 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:
Category | exam bundles |
Comments | 0 |
Rating | |
Sales | 0 |