This course is designed for the students who want to learn Java without any programming experiences before. We will start with the very beginning of program design and fundamental concepts about programs and machines. You are expected to be capable to implement your idea in Java independently after 30 hours of lectures. Furthermore, I wish you could learn other programming languages without suffering from starting over.
Date | Summary |
---|---|
2017.3.4 | programs, computational solutions, computer systems (CPUs, memory, memory hierarchy), programming languages (high-level, assembly, machine code), algorithms, JDK + Eclipse, first Java program; |
2017.3.5 | variables, data types (int, double, char, boolean), assignment operator (=), type conversion, arithmetic operators (+, -, *, /, %), rational operators (>, <, =), logical operators (!, &&, ||, ^), compounding operators (+=, ++); HW1: Lab 0 due 3/11; |
2017.3.11 | selections (if-else if-else, switch-case, ?: operator), pseudo random, loops (while, do-while, for); |
2017.3.12 | compounding problem, nested loops, analysis of algorithms; HW2: Lab 2 due 3/18; |
2017.3.18 | arrays, for-each loops, sorting algorithms, searching algorithms, briefing data structures; feedback; |
2017.3.19 | higher-dimensional arrays, matrix multiplication, defining methods, call stack, scope of variable, method overloading, recursion, classes & objects, fields and methods, encapsulation; HW3: Lab 5 due 3/25; |
2017.3.25 | constructors, this operator, static members, memory and objects, HAS-A relationship (aggregation and composition), IS-A relationship, inheritance, method overriding, binding, (subtype) polymorphism, up/down casting, instanceof operator; |
2017.3.26 | abstract classes, abstract methods, final (variable, method, class), interfaces, packages, wrapper classes, immutable objects, enum types, nested classes, anonymous classes, classpath, JAR; |
2017.4.1 | (no class) |
2017.4.2 | (no class) |
2017.4.8 | exception handling, strings, file I/O (I, II), GUI design, event handling; |
2017.4.9 | final exam (/sol/); feedback sheet; |
Install JDK 8 and Eclipse in your computer (desktop/laptop). Then printscreen the result of your first Java program which prints ``Hello, Java.'' on the screen. Send the screenshot to d00922011@csie.ntu.edu.tw.
Consider x * x * x - x - 3 = 0. Write a program which calculate the root of the aforesaid equation by using Bisection method. The Bisection method needs three parameters as input. Here we set a = 0 and b = 2 as the initial search interval, and also set eps = 1e-9 for numerical tolerance. The approximate root is 1.5214. You may use a while loop for this problem.
Write a program for number guessing. The program asks the user to enter an integer from (0, 99). Then the program updates the range depending on the input accordingly. If the input value is equal to the secret number, then the user wins. If there is only one integer left, then the user loses the game. Make sure that the user enters a number in the feasible range. If not, ask the user to redo the input. Send the source code (the file with .java extension) to d00922011@csie.ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
Write a program which implements the algorithm in p. 170 of the slides. (It could be difficult for the beginners to make it right.)
Write a program which implements the naive algorithm for matrix multiplication. For simplicity, consider two random integer matrices of size 3 by 3 as input. Output the resulting matrix of the aforesaid two matrices.
Write a recursive program which calculates x ^ y where x is any real number and y is an integer (note that y can be negative). For example, 2 ^ -10 = 0.000976. Try to make your program run in O(log |n|). Send the source code (the file with .java extension) to d00922011@csie.ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
Write a program which itself plays the number guessing in Lab 2. Try to organize your program in object-oriented programming. Send the source code (the file with .java extension, say homework2.java) to d00922011@csie.ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)