These two weeks, we further learnt about java looping.
Knowledge
This first concept we learnt was type casting. The basic syntax of this expression is (datatype)(expressions). However, if the expression is consisted of only one variable, the parenthesis around it is optional. For example, in the following exercise, only the last form can run.
Array
Array is a series of variables of same data type, and they are arranged in a particular sequence. The data type of each element, which is the basic unit of an array, can be any java primitive data type, like double, int, char or even a class. Programmers use an index to locate element, and this index is usually represented by “i”. Array is useful for applications like calculating statistics, or representing the state of a game.
Reference to an Array
We use syntax like the following to indicate reference to a array:
datatype[] arrayName;
For example, we can write it like this:
double[] groups=new double[5];
By doing so, we can create an array and give it a size.
Two Dimensional Array
Aside from normal linear array, we also learnt two dimensional array for HL topic (which is, finally, not control system anymore). Basically, it is an array of arrays. The principle behind this new type of array is basically similar to one dimensional array, but they are used under different situations. Instead of a linear line of contents, two dimensional array show stuff in a table form, which is 2D. This is useful to display information with two variables, like grades regard to a list of students. To create this form of array, two brackets are needed, like this:
double[][] grades={};
Two variables, or indexes, are needed to represent elements in a two dimensional array.
Exercises
The first exercise we did was a program to predict the hight of children by inputing heights of their parents. This exercise caused some confusion, because we were not used to feet and inch, so we had no idea how to declare the relationship between these two units.

The second program was introduced when learning the concept of type casting.

The third program was assigned as a homework. This program mainly required loop, a lot of loops and loops in loops. Initially I didn’t do the prime number one. I won’t tell you the reason for this was I thought it was difficult, so I chose the other easier ones.

This program was created when learning two dimensional array.

The final big one for the week was a grade program, which is the combination of everything we’ve covered in one dimensional array. The for loop can loop back to the beginning of the entire program so that if the user want to re-run the program, they do not have to quit the program and open it one more time. Instead, they can simply input a number and then the program can start again without deleting the previous result. Very impressive.
The “I–” in the if part can ask the use to input another value if the previous one is invalid. In can output the average, max and min number of the number in the array. We can say that it is a combination of everything we’ve learnt so far.

Conclusion
What we learnt this week is another progress in Java, but it is still nothing to the whole beauty of CS. The world is still big enough for us to explore. Stay strong and keep on going!