星期一, 10月 31, 2005

Homework Lab 11-21 (2) Class Definition

Study Display 4.2 & Display 4.3 and then
1. comment out date.setDate(6, 17, year); by // date.setDate(6, 17, year);
2. At the next line below, add date.readInput();
3. Run the program again. Fix any problems you may encouter along the way.
4. At the last line of your program, add System.out.println(date.month);
and see what happens. Why?

Lab 10-31 (1) product of N positive numbers

Compute the product of N positive numbers.
Mark the end with a negative mumber.

10-31 Quiz Fibonacci

Name 3 objects that demonstrate Fibonacci numbers and
illustrate the objects with figures.

Homework Lab 10-31 (2) Mean & Variance

Compute the variance of N positive numbers.
Mark the end with a negative mumber.

Homework 10-31 Lab (1) String Comparison

Write a Java program to check string equality for
String s1="I come from CYCU.";
String s2="I come from cycu.";

Can we do it with "=="?
What is the result for case-sensitive comparison?
What about case-insensitive?

11/14 no class

11/14 class will be rescheduled. No class on 11/14.

11/7 no class

During midterm week, we don't have class.

星期一, 10月 24, 2005

Lab 11-21 (1) Class Definition

Study Display 4.1 and then do Exercise 1.


Homework 10-24-2005 (2)

Reading Assignments:

Want to know more about Fibonacci number

Homework 10-24 (1) Lab exponential

Do Project 7 of Chap. 3. (2nd ed.) or Project 4 (1st ed.)

星期一, 10月 17, 2005

Lab 10-31 Lab (2) Fibonacci numbers.

Do Project 3.3 Fibonacci numbers.
List the first 100 numbers and the ratio of
a number to its previous number.

Want to know more about Fibonacci number

Lab Max-Min

Based on your study of Display 3.8, write a code to find the max and min of a list of number.

Lab If-Else (2)

Based on your study of Display 3.1, develop your code for Exercise 8.

Homework 10-17

Do Project 2.05 (2nd ed.) or Project 2.03 (1st ed.)
Do Project 2.07 (2nd ed.) or Project 2.05 (1st ed.)

Reading Assignments: Sec. 1.4; Sec. 2.1, Sec. 2.2, Chap. 3 of Textbook.

Lab If-Else

Do Display 3.1.

double netIncome = some figure; // a figure you choose

Lab Scanner

Do Display 2.6 on Page 79.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

Change

Scanner keyboard= new Scanner(System.in);

into

BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));

String inputString = keyboard.readLine();

answer

import javax.swing.JOptionPane;

public class Untitled1 {
public Untitled1() {
}


public static void main(String[] args) {

String myString=JOptionPane.showInputDialog("Enter a number: ");
int myNumber=Integer.parseInt(myString);
System.out.println("The number is "+myNumber);
System.exit(0);
}
}

Lab JOptionPane

Use the following command to generate a window input dialog

String myString=JOptionPane.showInputDialog("Enter a number: ");

use the following command to convert a string to a number

int myNumber = Integer.parseInt(myString);

and finally use the following command to print the input number to the console

System.out.println("The number is "+ myNumber);

Don't forget the following import command

import javax.swing.JOptionPane;

so that Java can recognize JOptionPane library.

星期一, 10月 03, 2005

Lab 10-03-2005

Display 1.7 of Chap. 1

Project 5 of Chap. 1

"tell me and I'll forget; show me and I may remember; involve me and I'll understand"