CS 55   Java Programming

Week 3

Agenda

Example

Exercise3_8Applet.html Exercise 3.8 (Exercise 3.9 in 5th edition.) Source code: Exercise3_8Applet.java

Lab03

  1. Write an applet that inputs from the user the radius of a circle as a floating-point number and displays the circle's diameter, circumference, and area. For you may use either the literal constant 3.14159 or the symbolic constant Math.PI. Use the  techniques shown in Fig. 3.13 (the AdditionApplet.java example). Use the following formulas:

    diameter = 2r
    circumference = 2∏r
    area = ∏r2

  2. Write an applet that  inputs from the user two integers and determines whether the first is a multiple of the second and displays the result. [Hint: Use the modulus (aka remainder) operator.]

Test 1 Information

 < CS 55  > Home Email Last Modified September 10, 2004