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

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Apply Index

Apply Page # 2

Activity 2 – Factorial class

In an earlier unit you will have written a program to calculate the factorial of a number — a model answer is Factorial1.java.

Modify this program so that it uses a class called Factorial to do the calculation. This class should have a method called calculateFactorial() which contains the code to do the calculation itself. In the program's main class, you should get the answer by executing:

Factorial.calculateFactorial(50);

Discussion/Suggested solution to Activity 2
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