Sunday 14 August 2011

Week 3: Minutes (Monday)

Minutes:
- Variables & types
- Value assignment to variables
- Printing values of variable out
- Operators and their order
- Compositions of operators
- Compositions with printing command
- A lot of examples demonstrated

Code:
public class w3c2 {
public static void main(String[] args) {
//******* Declaration of Variables****//
String val;
int num;
int n1,n2,add,sub,mul,div;
double pwr;
//int double;
double weight;
//********* Variables & Assignment ****//
System.out.print(val);
System.out.print(", number:");
System.out.print(num);
System.out.print(", weighted:");
System.out.print(weight);
//********* Operatiors ****//
n1=8;
n2=2;
add = n1+n2;
sub = n1-n2;
mul = n1*n2;
div = n1/n2;
pwr = Math.pow(n1,n2);
System.out.println("Again, power = " + pwr);
System.out.println("Again, multiplication = " + (n1+n2));
System.out.println("All in order ADD,SUB,MUL,DIV,PWR:" + add + ", " + sub + ", " + mul + ", "+ div + ", " + pwr);
System.out.println("All in order ADD,SUB,MUL,DIV,PWR:" +(n1+n2)+ ", " + (n1-n2) + ", " + n1*n2 + ", "+ n2/n2 + ", " + (Math.pow(n1,n2)));
// Remove parenthesis of all operators
//******* Operators for Strings*******//
/*
String st,st1, st2;
st1 = "We are ";
st2 = "UBD students";
st = st1 + st2;
System.out.println(st1);
System.out.println(st2);
System.out.println(st);
*/
//num = squared(6);
// System.out.println("Value:" + squared(81));
//System.out.println("Value:" + Math.sqrt(5));
//squared(3);
//num = Math.sqrt(5);
//num = squared(5);
//System.out.println("The value" + num);

}


Hints: to make a program to solve a problem, you should think in the top-down analysis:
- what problem do I want to solve?
- how many variable do I need for this problem?
- choose types for the variables
- declare the variables
- use operators with special attention of their order (usually using Parenthesis to make the statement more clear)
- assign simple values for the test
- test and evaluate



Week 2: Minutes (Wednesday)

- a program
- debugging
- formal vs. natural language
- Java compiler installation and editor
- The first program "Hello World!"
- The tutorial 1.
It is expected that all students can compile the first program and go through the tutorial 1 as well.

Tuesday 9 August 2011

Week 2: Tutorial 1 - the First program

To start the first program, open Jedit, then copy & paste the following code:


public class HelloWorld {
      public static void main(String[] args) {
          System.out.println("Hello, World");
     } 
}


Save the code as the file named HelloWorld.java
Go to cmd windows in Windows OS or open terminal on MAC OS, then type


> javac HelloWorld.java


> java HelloWorld


See the output on the screen


Do the following exercises:


1. Replace "HelloWorld" by "Your name", then make a new line 
System.out.println("We are SS-1201 students at the Faculty of Science, Universiti Brunei Darussalam");
2. Replace println by print 
3. Use the println and print to make a STAR formation of symbol *
4. Try to remove ; from System.out.println("Hello, World"); save and compile the code to see the error!
5. Try to remove the inner bracket {}, save & compile the code to see error!


Week 2: Minutes (Monday)

- Seventeen students attended the course
- History of programming languages
- Programming paradigms (7)
- Application domains of programming languages
- Reasons to study programming language and how to study a new language
- Reasons of choosing JAVA as the official programming language for the course
- Hits to study a new programing language

We will continue the theoretical lecture on Wednesday, then have a tutorial of how to install Java compiler, choose editors, and test the first program if we still have time.

All students are recommended to bring their own laptop to install the compiler and editors.

Friday 5 August 2011

Week 2: Tutorial time and location & ...

I just reserved a room (M.12-Hardware lab) for your tutorial on Wednesday 10:10 - 12:00.

Please bring your laptop if you have. I will post a guide how to install the JAVA complier as well as recommended editor for Windows, MAC, and Linux soon.

Note that if any of you uses Linux, please post a comment on this post. Otherwise, I will not prepare a guide of Linux.


Monday 1 August 2011

Week 1: No tutorial and recommended reading

Breakingnews: due to the Faculty registrar, there is no timetable of the availability of classrooms for the first week, hence, we do not have tutorial this week.
All students are recommended to read Chapter 1 of the textbook: How to Think like a Computer Scientist.

The textbook can be downloaded from : http://greenteapress.com/thinkapjava/

See you all next Monday and wish all Islamic students have a Happy Ramadan!

Week 1: Minutes

- Totally 12 students appeared. An expected number is around 15-16!
- All introduced each other
- Learning methodology of the university education was briefly presented
- Problem-based learning methods and teamwork skills were provided
- The course's learning materials were presented
- Rules of the courses were proposed and agreed by students
- Course evaluation was mentioned

So far, the students agreed on the tutorial time: Wednesday 10:15-12:00.
Latest news: due to the availability of classrooms, no tutorial this week