This course is designed for the students who want to learn Java but have 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.7.8 | programs, computational solutions, computer systems (CPUs, memory, memory hierarchy), programming languages (high-level, assembly, machine code), algorithms, JDK + Eclipse, first Java program; |
2017.7.9 | variables, data types (int, double, char, boolean) (see Some disasters attributable to Numerical Analysis), arithmetic operators (+, -, *, /, %), assignment operator (=), type conversion, rational operators (>, <, ==), logical operators (!, &&, ||, ^), compound operators (+=, ++); HW1: Lab 0 due 7/15; |
2017.7.15 | selections (if-else if-else, switch-case, ?: operator), pseudo random, loops (while, do-while, for), jump statements; |
2017.7.16 | nested loops, analysis of algorithms, arrays; HW2: Lab 2 due 7/22; |
2017.7.22 | for-each loops, sorting algorithms, searching algorithms, briefing data structures, higher-dimensional arrays, methods; |
2017.7.23 | call stack, scope of variable, method overloading, recursion (also read this; see more examples: ch18-recurex), abstraction, classes & objects; HW3: Lab 3 due 7/29; |
2017.7.29 | fields and methods, encapsulation, constructors,this operator, static members, gargabe collection, HAS-A relationship (aggregation), memory and objects, IS-A relationship, inheritance; |
2017.7.30 | (no class) |
2017.8.5 | (no class) |
2017.8.6 | method overriding, binding, (subtype) polymorphism, up/down casting, instanceof operator, final variable/method/class, abstract classes/methods, interfaces, packages, wrapper classes, immutable objects, enum types; HW4: Lab 4 due 8/12; |
2017.8.12 | namespace, nested classes, anonymous classes, iterators, classpath, JAR, assertion and exception handling, strings, regular expressions (see regex by Oracle, or regexp, regex crossword), file I/O, events, listeners, callbacks, Java graphics and GUIs, Java event handling, Java 2D games tutorial (see snake game), JavaFX tutorial; |
2017.8.13 | final exam (/java/283/sol/); feedback for midterm, feedback for final; |
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@ntu.edu.tw.
Let x be any real number. Write a program which calculate the square root of x by using Bisection method. You may use a while loop for this problem. The function Math.pow and Math.sqrt are not allowed.
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@ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
Write an AI program which plays the number guessing game. Also calculate the winning rate by simulating your AI program for 1e5 times
Let x be any real number and y be any integer (n can be negative). Write a program which calculates x ^ n by recursion. For example, 2 ^ -10 = 0.000976. Try to make your program run in O(log | n |) time. Note that you are not allowed to use Math.pow and for/while loops in your solution. Send the source code (the file with .java extension) to d00922011@ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
Rewrite the program in Lab 2 in object-oriented programming. You may define any number of classes if necessary. Send the source code (the file with .java extension, say homework2.java) to d00922011@ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
TBD. Send the source code (the file with .java extension, say homework2.java) to d00922011@ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)
Write a painting program which looks like Microsoft Paint. Send the source code (the file with .java extension, say homework2.java) to d00922011@ntu.edu.tw. (Do not attach any class file because any executable file will be ruled out by Gmail.)