Monday, October 29, 2018

...Lab6...

Assalamu'alaikum and hello


This time I will share about the assignment that has given. We are required to declare and manipulate strings and character using methods provided by Character and String class. Here I include all of the tasks that I have done. 



1. a. System.out.printf( “%6b”, ( 1 > 2 ) );
    b. System.out.printf( “%6s\n”, “Java”);
    c. System.out.printf(“Amount is %f %e”, 32.32, 32.32);
    d. System.out.printf(“%8d%8.1f”, 1234, 5.6321);
    e. System.out.printf(“%-8d%-8.1f”, 1234, 5.6321);





2.  String s1 = “Welcome to Java”;
     String s2 = “Welcome to Java”;
     String s3 = new String(“Welcome to Java”);

     System.out.println( s1 == s2);
     System.out.println( s1 == s3);





3. Write an application that uses String method compareTo to compare two strings input by the user.
Output whether the first string is less than, equal to or greater than the second.





4. Write a program that displays a random lowercase letter using the Math.random() method.





5. Write a program that receives a character and displays its ASCII code (an integer between 1 and
127). Here is a sample run:

Enter a character: E <enter>
The ASCII code for character E is 69





We are also required to write a program that prompts the user to enter a password in which the password displays whether it is valid password or invalid password based on the password rule.






That’s all from me. Remain positive though it is impossible. Have a nice day ^_^



Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)




Next blog : kychoong.blogspot.com (Choong Kar Yee)

Wednesday, October 24, 2018

...Lab5...



Assalamu’alaikum and hello.

After I done Lab5, I understand more about the use of switch statement and conditional operator. In switch statement, there is a word which is ‘break’ that used at the end of each case in order to terminate the remainder of the switch statement. However, this word just an optional but if the break statement absent, it will execute the next case statement. This means that although the break statement is an optional, its absence will give different effect.

This is one of the programs that we need to create. It becomes more interesting when we need to create a program where it will generate numbers randomly based on the designated month.






I found it to be very interesting as more I learned about computer programming. I feel very grateful for the opportunity to learn this subject.

That’s all from me. Remain positive though it is impossible. Have a nice day ^_^


Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)





Next blog : kychoong.blogspot.com (Choong Kar Yee)














Friday, October 19, 2018

...Lab4...


Assalamu'alaikum and hello. It's me again. I'm really happy to have set up Lab 4 after I've been working for a few days to get it done. We are assigned to produce a game using java program. For me, it is not so easy and not too difficult. At first I thought it was easy because we were assigned to solve a single question, but instead it happened. A question where I need to create a game using java program makes me more sensitive in compiling every solution so that it can run smoothly. At beginning of the game, I found a lot of mistakes while trying to make the game. One of the interesting things in producing this is that it makes me imagine what might be impossible to happen in the reality. It becomes a satisfaction when we succeed in completing a job. That's what I feel when I succeed run the game. 

Here I attached the game that I have successfully created using java.



























































That's all from me. Thank you ^_^


Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)




Next blog : kychoong.blogspot.com (Choong Kar Yee)

Tuesday, October 16, 2018

...Lab0...


Assalamu’alaikum and hello. Actually, this is the first time I am writing in a blog. I just want to share some of my knowledge in learning computer programming. I am very excited to be given the opportunity to learn this subject. At the beginning of the lecture, we have been taught on how to create folders in personal computer by using Command Prompt Commands (cmd). Here I will tell you the way I did it. 


First of all, I need to edit one of the variables (path) that available in environment variables.  After edited it, I am ready to run the java. Next, I tried to familiarize myself with the terms of cmd by using the existing folders in computer. The ‘dir’ used to list all of the directory that contain in the folders. By typing ‘cd <name of directory>’, it will show the folders that required and ‘cd..’ to go back to the directory before. Here I show the process that I have done.




After I have familiarized with the terms, I tried to create my own folder with the name of ‘Reen’ by typing ‘mkdir Reen’. Next, I need to create another folder with the name of ‘Lab0’ and make sure the folder exist in Reen’s folder. In the Lab0 folder, I need to create a file by using notepad. Here I have to type every single word that has been given careful, so that there is no mistake in typing and then save it in Lab0. When I have followed all of the instructions, I need to compile the java program. Lastly, when I run the program, the words ‘Hello World’ successfully appeared.  





What can I say is, it is not as easy as I thought and of course I have tried it for several times. Thanks to my friend for helping me until I succeed did it. 


Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)


Next blog : kychoong.blogspot.com (Choong Kar Yee)










































Wednesday, October 10, 2018

...Lab3...


Assalamu’alaikum and hello. This is my reflection on Lab 3. Based on the programs given, we need to trace the programs either there were any errors or not. As usual, there were errors in the programs after we compile and run it and we need to fix it.

For example, in this Test2 program, we need to uncomment the line 11. However, there was an error when we uncomment it. So, the best way, we can just delete line 11 or declare the value of a and b then print the sentence of the submission between a and b.






I also learn the used of one-way if statements in java program through this Lab. After the word ‘if’, we need to put bracket between the Boolean expressions and put the block between the statements. The block itself is a type of statement. Thus, we can execute more than one statement between the block. For example,

if (booleanExpression) {
   statement(s);
}



Other than that, we need to write programs. It’s quite difficult to make the programs as required. I have done it several times which there were a lot of errors before getting the best results. Here I show you one of the programs that I have done as required:





That's all from me for Lab3. Thank you ^_^


Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)





Next blog : kychoong.blogspot.com (Choong Kar Yee)






Wednesday, October 3, 2018

...Lab2...



Assalamu’alaikum and hello  ^_^ 

I’m going to reflect on our Lab2 assignment. As usual, the more we learn, the more difficulties we will defined. First of all, we need to trace the programs given as we did in Lab1. When we getting familiar with the program, we will find it is easy to detect the errors in the programs. The errors consist of syntax error, runtime error and logic error. We should also know on how to use each of data type in Java which are byte, int, short, long, double, float, char and Boolean.

Here I attached one of the programs that contain errors with the right one.









Then, we need to develop a program for each situation given which the programs let the user to enter the value of input. Thus, the program will compute it and display the results. What can I say is, this assignment wants to test our understanding on how to develop programs and how to get the input from users.



Nurazreen binti Mohd Nor (182433)

SSK3100 (Group 15)





Next blog : kychoong.blogspot.com (Choong Kar Yee)

...Lab10...

Assalamu'alaikum and hello I'm going to share about the assignment that has given (Lab10) on topic array. We are required to def...