星期五, 12月 30, 2005

星期一, 12月 26, 2005

Lab 1-02-2006 modular sorting

Write a sort method which takes a double array as parameter
and returns the sorted array. Call this method in a main program.

Hint: The lab is a rewriting of Lab Sorting
to make the sorting procedure a reusable method.

Lab 12-26-2005 (2)

Write a java program and run it at command lines. Input any parameter list and output the reverse list. For example, if you enter

java someProgram 1 3 5 4 6

the putput is

6 4 5 3 1

You program should be able to handle a
null parameter, i.e. no parameters.

Lab 12-26-2005 (1)

Write a java program and run it at command lines as

java someProgram Hi ! there

The program should output

Hi there !
The length of parameter is 3.

星期一, 12月 19, 2005

Lab 1-02-2006 Recursion

Develop a recursive java code that computes factorial of N where N!= 1* 2 * 3 * ... * (N-1) * N.

Homework 12-19-2005 Lab Equal Arrays

Study Display 6.3 and define two arrays
int[] a={1,9,6,4,0,2,1,2} and int[] b={1,9,6,4,0,2,1,2}.
Write a program to verify that they are equal.

Lab 12-19-2005 Sorting

Study Display 6.1, and then write a program that can sort 5 numbers in ascending order. The 5 numbers are input by the user.

星期一, 12月 12, 2005

Homework 12-12-2005 Counter II

1. Continued from your Counter Homework, include implementations of toString method
and equals method. You should include the statements in the main that test equals method.

星期一, 12月 05, 2005

Homework 12-5-2005

Do Temperature Project, which is Project 7 (2nd ed.) or Project 3 (1st ed.).

Lab 12-12-2005 (1) Constructor

Do 4.13 and use 4.14 to call 4.13. (2nd ed.)

Do 4.11 and use 4.12 to call 4.11. (1st ed. )

Lab 12-5-2005 (2) Overloading

Step 1. Do Display 4.11 (4.9, 1st ed.) and use Display 4.12 (4.10 1st ed.) to call 4.11. (4.9 1st ed.)

Step 2.

Add two method definitions
public void setMonth(int month)
public void setMonth(String month)

Step 3.

Use Display 4.12
and change the codes in yellow shaded area as
date1.setDate(1,2,2007);
date1.setMonth(3);
date2.setDate("Feb",2,2007);
date2.setMonth("Apr");
date3.setDate(2007);

Step 4. Show the results of your program execution.

星期日, 12月 04, 2005

Lab 12-5-2005 (1) Using "this"

Based on Lab 11-28-2005,
rewrite the class program with "this" where applicable.