EE5805 Java Programming and Applications
http://www.ee.cityu.edu.hk/
The Tutorial notes of EE5805 or EE3206 Java Programming and Application is shown as follows:
EE3206 or EE5805: Tutorial 2 – Developing Java Applications with NetBeans
1. Read the online training below and follow the steps to familiarize yourself with
the NetBeans development tools.
Before generating Javadoc, do add some Javadoc style comments for the acrostic method (e.g. @param, @return, @see, etc.) and see the Javadoc output.
Introduction to Developing General Java Applications
http://www.netbeans.org/kb/60/java/javase-intro.html
2. Create a project “JTutor02”. Write a Java class “Circle” and complete its method of the following header.
Test the class by writing a main method to show the area of circles with radii ranging from 10 to 100, with increment of 10.
static double circleArea(double radius);
3. Computer programs commonly need to process numerical data and characters.
Each character has a unique Unicode between 0 and FFFF in hexadecimal (65535
in decimal).
To generate a random character is to generate a random integer
between 0 and 65535.
Now write a class to generate random characters. A template, as shown in Code 1, is provided for you. You have to write a driver to
test your class.
4. Using the RandomCharacter class, write another program to generate 100
lowercase letters randomly and assign to an array of characters. Count the
occurrence of each letter and display to the screen.
Code 1 – Template of RandomCharacter.java
// RandomCharacter.java: Generate random characters
public class RandomCharacter {
/** Generate a random character between ch1 and ch2 */
public static char getRandomCharacter(char ch1, char ch2)
{
// write your code here
}
/** Generate a random lowercase letter */
public static char getRandomLowerCaseLetter()
{
// write your code here
}
/** Generate a random uppercase letter */
public static char getRandomUpperCaseLetter()
{
// write your code here
}
/** Generate a random digit character */
public static char getRandomDigitCharacter()
{
// write your code here
}
/** Generate a random character */
public static char getRandomCharacter()
{
// write your code here
}
}
- END -
http://www.cityu.edu.hk/arro/catalogue/course_EE.htm
Keine Kommentare:
Kommentar veröffentlichen