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 | Key points and memo | Sample code |
---|---|---|
2016.11.19 | programs, computational solutions, computer systems (CPU, memory, memory hierarchy), algorithms, programming languages (high-level, assembly, machine code), JDK + Eclipse, variables, data types (int, double); | |
2016.11.20 | data types (char, boolean), type conversion, assignment operator, arithmetic/rational/logical operators, selections (if-else if-else); HW1: Lab 0 due 11/26; | |
2016.11.26 | selections (switch-case, ?: operator), loops (while, do-while, for); | CashierProblemDemo.java, CompoundingDemo.java , FindMaxDemo.java, MonteCarloDemo.java, PrimeDemo.java; |
2016.11.27 | nested loops, analysis of algorithms, arrays; HW2: Lab 2 due 12/3; | BisectionDemo.java, MultiplicationTableDemo.java, PrintStarDemo.java, FindMax2Demo.java; |
2016.12.3 | for-each loops, sorting algorithms, searching algorithms, briefing data structures, higher-dimensional arrays, matrix multiplication; | GuessNumberDemo.java; |
2016.12.4 | defining methods, call stack, scope of variable, method overloading, recursion; HW3: Lab 5 due 12/10; feedback; | MethodsDemo.java, SelectionSortDemo.java; |
2016.12.10 | classes & objects, fields and methods, encapsulation, constructors, this operator, static members, HAS-A relationship (aggregation and composition); | PointDemo.java, RPGDemo.java; |
2016.12.11 | IS-A relationship, inheritance, method overriding, (subtype) polymorphism, up/down casting, binding, abstract classes, abstract methods, final; HW4: Lab 6 due 12/17; | StudentDemo.java; |
2016.12.17 | interfaces, packages, classpath, JAR, exception handling, Difference between Procedure Oriented Programming and Object Oriented Programming, memory and objects; | InterfaceDemo.java, EnumDemo.java, ExceptionDemo.java, Test.java, PackageDemo.java; |
2016.12.18 | GUI design, event handling, multithreading (FYR: Java Threads), Kelly's formula, Martingale, file I/O, design patterns; | CircleDemo.java, FirstGUI.java, NumberGuessingDemo.java, NumberGuessingDemo2.java; |
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 value 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, then ask the user to redo the input. 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.)
Write a program which implements the algorithm in p. 168 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, 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.)
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.)