Tuesday, October 2, 2018

Lab 1

This is the second lab for this course and it become complication since I never learnt anything about this before.So it is kind of confusing to me. But after many time i done the question, it increase the understanding of me about the java.

First, I get to know that "public static void main(String[] args)" is very important. Every single word, upper and lowercase for that sentence is very important. We can't leave any words behind for us to run a success java program.

Besides, we also need to declare every symbol that we gonna to use before we can run the program. If we declare the word in lowercase then it should be in lower case. For the "int" it only declare for integer and no decimal. If we want the answer to be in correct decimal answer, then we should "double" it.

Another problem I realize is we can't really get the answer if the value is too big for certain data type. It can be consider as overflow because every data type had it own range. For example, in Test 6, I can't really get the answer for it as it write that the value is too big and I googling it and realize we can solve it by putting L letter behind the value which the L letter also mean by long.

In Test 8 that I can't get the answer of 0.1, it appears 0.1999998876 something which just a value that is close to 0.1. It will happen because computer is in binary and 0.1 doesn't have a finite representation in decimal. Therefore, I try to control the decimal point by import the DecimalFormat which I had learnt in computational physics.

In Test 9, that actually is a run-time error occurs since it is divide by integer 0.

Next link: Oh Hui Min

Saturday, September 22, 2018

Lab 0

From this lab, I learnt how to use the basic command in command prompt and compile a file that was written in java. 
  
First, I learnt "dir" is to show the list of file in a certain folder.

And command "cd" is to navigate us to the specific file that we wanna to go. If want to return back to the previous file just command "cd..". If we wanna make a new folder or file using the cmd, command "mkdir name_of_the_file" and it will appear at the place that we have created it.
There still have many ways to create the files, such as by pressing "Ctrl +Shift+n", right-click -> New > New folder, using PHP, VBA and others. 

Next by command "javac" in the cmd to made sure that java is function and start compile the file that we want to compile. After successfully compiled, a file of "file_name.class" will appear. This process means the source code had transform into machine languange. After, success, type "java file_name" to run the program.
Besides, every symbols, capital, and every single things for the code is every important for whether we can success compile the file. If fail to do so which means failed to run the program.

How is data store in computer?
Computer data storage can broken down into three basic processes. First, data is convert to simple numbers that are easy for a computer to store. Second, the numbers are recorded by hardware inside the computer. Third, the numbers are organized, moved to temporary storage and manipulated by programs or software.



Lab 1

This is the second lab for this course and it become complication since I never learnt anything about this before.So it is kind of confusing...