您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Apply Index

Apply Page # 1

Activity 1 – Applet to display and total array elements

(1) Write an applet creates an int array called capacity , which records for 4 machines how many products they can produce each hour:

  • machine 0 produces 55 products per hour
  • machine 1 produces 34 products per hour
  • machine 2 produces 80 products per hour
  • machine 3 produces 101 products per hour

(2) add a loop to your applet, so the contents of the array are displayed in the applets window.

image9.gif (3629 bytes)

Write your applet so that the screen is similar to the following:

(3) add a loop to your applet that calculates the total capacity of all 4 machines

Discussion/Suggested solution to Activity 1

Back to content

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg