304311 Java Lab 

 Lab 3

Objective

To introduce events and elements required for programming graphical user interface.

Classwork:

  1. Write a method integerPower ( base , exponent ) that returns the value of base exponent .  For example, integerPower(3,4)=3*3*3*3. Assume that exponent is a positive, nonzero integer and base is an integer. Method integerPower should use for or while to control thr calculation. Don�t use any math library methods. Incorporate this method into an applet that reads integer value from JTextField  for base and exponent from the user and perform the calculation with the integerPower method.

  2. An integer is said to be prime if it is divisible only by 1 and itself. For example, 2, 3, 5 and 7and prime, but 4,6, and 8 are not.

            Write a method that determines if a number is prime.

            Use this method in an applet that determines and prints all the prime numbers between 1 And 10,000. Display the result in a JtextArea that has scrolling functionality.

Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9

 � All Copyright Reserved By Fatma & Tahany,Email : [email protected]

Hosted by www.Geocities.ws

1