Hands On Java: Project 3


 

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

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

3.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

3.3. The two solutions of a quadratic equation

   y = ax2 + bx + c

can be found using the quadratic formula:

   solution1 = -b + the square root of (b2 - 4ac)
               -----------------------------------
                              2a

and

   solution2 = -b - the square root of (b2 - 4ac)
               -----------------------------------
                              2a

Write a program that inputs values for a, b and c, and outputs the values of solution1 and solution2. Use boolean expressions to print out true/false depending on if

3.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.

Turn In: A hard copy of this grade sheet, attached to hard copies of

  1. your source program; and
  2. the output from three executions of your executable program.

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


Back to the Lab Table of Contents

Back to the Lab Exercise


Back to the Table of Contents

Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.