Thursday, March 31, 2011

OSSLT Exam

Today, we wrote the Ontario Secondary School Literacy Test which was designed for all grade 10 students in Ontario. The timing was scheduled so all students throughout the province write it at the same time. The exam began at 9 and ended at 11:45 with a 15 minute break in between. The exam was manageable however, the writing was long. The space was limited to express your ideas. Due to the exam, there were no classes today and interviews began in the afternoon. I am looking forward to speaking with my teachers about my performance later today.

Wednesday, March 30, 2011

Learning the GNFRFCPWL...

Today, we reviewed the homework classes on the secret number and repetition. I had a doubt about the program and the answer was in the powerpoint for Mr.Arkin's Guaranteed Never Fails Rules for Computer Programming While Loops. These four easy steps can help any programmer in writing while loops, unless you make errors with parseInt or comparing strings as I did. But, we learn from our mistakes and I surely did!

After the lesson, some of the students were quite hyped in the India vs. Pakistan cricket match for the World Cup. India won with a lead of 29 runs and is moving on to the finals. Yay! :) I was able to complete the magic number program and a challenge was to modify it with displaying previous scores and adjusting ranges to show: cold, very cold, warm, very warm. I completed them with previous knowledge from this course.

Tuesday, March 29, 2011

Flow Control

Today, we got our code off results for the course and course section class. My team was successful in creating code tested without flaws. We learned flow control and the three types: sequence, selection and repetition. We were given the syntax for the if statements, while loops, do-while loops, and for loops. With repetition, there are indeterminate and determinate loops. Finally, the breaking flow consists of break and continue. Also, blocks  define the scope of variables. Using the different types of flow control, our code can be more efficient as you wouldn’t have to rewrite code several times.

Monday, March 28, 2011

Input Output Assignments

Mr. Arkin surprised the class with a party planned for April 1st! I first thought that it was a trick because April 1st is April Fool’s Day. Today, we also began the Input Output Assignments. Import statements are needed to access packages such as Buffered Reader, Input Stream Reader, IOException, etc. These statements also need to be in alphabetical order at the very top. The Buffered Reader allows the program to interact with the user through a file or the console. We also need to close the inputFile and the outputFile at the end of the code. We also learned parsing integers and doubles because any line of text read from the input file is taken in as a string. With Buffered Reader and File Writer, programs can help the users in solving problems.

Friday, March 25, 2011

Data Structures

Today, all the teams published the Course and CourseSection classes. We were asked to challenge another team. My team equally worked hard as before on the Student class. We hope that our code will once again be flawless. A lesson was taught today on Data Structures consisting of arrays which are collections of like variables stored under a single name. The first element is called the zeroth element. It is declared and initialized like the following: int[] a = new int[10];. Every array knows its length and you can call the elements as index or subscript.

This will be helpful when long lists of data need to be read and you can store them all under an array. Data structures in general are a scheme for organizing related pieces of information. Static data structure’s size and nature are determined before the program is executed. You can change the values stored in arrays as well. I can’t wait to start writing complicated programs with arrays.

Thursday, March 24, 2011

Comparing two Strings

Today, we continued to work on our Course and CourseSection class in our teams. Seems like there are a few overlapping elements but I clarified them with Mr.Arkin. I also found out that you can create arrays with other data types than the general String, int, double, etc. When comparing two strings, you cannot use an if statement with a direct equals operator and check if it equals a String. This is because Strings are objects, therefore, we need to use a string method such as the equals method, or the compareTo method. This advice helped when we were comparing our course elements in the array. We are continuing to refine the code so the code cannot be broken.

Wednesday, March 23, 2011

Course and Course Section class

We began the course and course section class. A course needs to know its title, description, code, department, course section and the course section needs to know its teacher, students, room, enrolled students, max and min number of spots available. We continued to work in the same teams as the Student Class. There is a possibility for a course to have more than one section and to help us, Mr. Arkin taught us about “The Zen of Void”. I am encountering a few errors with the array of Course Sections but I hope to fix them by tomorrow.

Tuesday, March 22, 2011

Won the code-off ... (sort of)

Last night, my team completed the class and posted our links on the wiki. Today in class, we switched our code with several teams such as Andy's and Rampragash's team. They both returned with the message of “unbeatable” and we were delighted. We took the extra step in the method for the date of birth in checking for the individual months and leap years. Finally, Mark's team came back with the same message however near the end, they found a mistake. We forgot to put “this.” to differentiate from the parameter and the instance variable. We were a bit disappointed but we learn from our mistakes so we were happy with our accomplishment. We also began the course class in the same teams and we hope to create code without any errors this time.

Monday, March 21, 2011

Student Class

As we got back from the March Break, Mr. Arkin decided to warm up our Java skills so we had a Student Class Code-off. This class was designed so a student would know their name, date of birth, and gender and at least 3 more things about him or herself. We also had several other requirements such as a toString method and a public and private constant. We were put into teams of 3 and our goal is to break the code of the defender's team with the link to the Javadoc, class and tester file. Jessie, Regina and myself seem to be at a good position in creating the skeleton. I think we will be successful in this code-off.

Friday, March 11, 2011

Aboard Victoria Airways

For homework, we had to brainstorm for the Victoria Airways class. My team chose the customer class. Today in class, we put up our lists on the board for verification by Mr.Arkin. We realized that we were missing a very important component - the name of the customer. Similarly, the flight segment and the airplane class requirements were also modified. After approval, we began writing the Javadoc and the outline. We also managed to write the instance variables. The bell rang and we were overjoyed as it was March break. No homework was assigned but I think I will get a head start on this class.

Thursday, March 10, 2011

Advancing with the BoatSeller Class

I guess now that everyone is on the “boat”, we decided to start selling them. After the completion of the Person class, for the tester, we had to implement the BoatSeller Class. As we create a person with a name, age, gender, height and weight, we now can assume that they have a boat and they also need to specify the type, name and tonnage of the boat. Our homework was to brainstorm for the Victoria Airways Class in teams of 3. We assigned the customer, flight and airplane class for two teams per topic using the Wikispaces.

Wednesday, March 9, 2011

Satisfaction of Completion

Today, I completed the enhanced calculator class. In this class, I also learned in depth about number formatter that helps to set decimal places for a real number. Since I had some free time to spare, I read the Javadoc for the Person Class so I can get started with it for tomorrow’s class. I created the skeletal outline for the Person class so all I need to do is to insert the code.

Tuesday, March 8, 2011

Import Statements

When writing a program, there are certain classes that need a package to be imported. An example of an import statement is: import java.io.* . These import statements must be at the very top of the program and also written in alphabetical order. Today, I continued working on the Enhanced Calculator Class. I am on the verge of finishing.

Monday, March 7, 2011

Shorter is better!

There are classes with special values stored for MIN_VALUE and MAX_VALUE which makes life a lot easier in some circumstances. Evaluating boolean expressions such as (a==b) does not need a full-length if statement. Instead, we can write one line: “return a==b;”. This reduces our code length when we are writing really long programs. A review list of operators was given with symbols similar to math except for equal to (= =),  not equal to (!=), and (&&), or (||). Other than these exceptions, the rest are the same when comparing two values.

Friday, March 4, 2011

"this.variable" is not the same as "variable"

Today, we learned that if the variable in the parameter had the same name as your instance variable, you must use “this.” to differentiate the two. I hope I remember this as I might forget. I was able to complete the Simple Calculator Class and get started with the Enhanced Calculator Class. It is more advanced than the previous one hence the term “enhanced”. We are progressing with writing programs without skeletons and composing our own tester programs.

Thursday, March 3, 2011

Catching up on the lifeBoat!

Up until now, every individual was at a different stage in comprehension of Java. Today, was a recap day of clarifying doubts with a question and answer period. This helped a lot of students with the Boat class example. I felt that I could work on the Purse class and I was able to complete it. As I started on the Simple Calculator Class, I paid close attention to the discussion as it helped me in pursuing the calculator class.

At lunch, I was able to correct my CCC problems and I was happy in the end with a grand total of 51 points. I hope to learn how to code the last question correctly for the future.

Wednesday, March 2, 2011

Javadoc, (Parameters), and CONSTANTS

Learning to write a javadoc is quite fascinating as it is the backbone for any programmer to write a program. However, you need to write in 3rd person plural. Constants must be entirely in CAPITAL letters. Today, we learnt how to declare methods with parameters and call methods with arguments. The toString method is very important to return a string representation of the code. With this much progress, we will soon start writing complicated programs. YAY!

Tuesday, March 1, 2011

CCC!

My mind was working hard for the second half of the day in coding problems for the Canadian Computing Contest. It felt like there was a lot of time in the beginning (3 hours to be precise), but near the end, I was rushing for time. It wasn't as hard as I expected. I was shocked to see the first question as it could be done by an amateur programmer (not completely). The 4th and 5th question really was challenging and I had to rack my brain for it. I was able to solve the mining question; however, the network question was truly complicated. Overall, I thought it was a good experience!