Friday, November 23, 2018

REFLECTION OF LAB7


Hello people☺!!! Its a pleasure to meet you all after a very long break. How have things been going ? Hope you guys doing really really good over there. Alright guys its time to back to our weekly routine to discuss about the Lab Assignment 7, whoooaa... This time we have learned about Loops.

There are many categories of loops such as while loops, for loops, do-while loops and also nested loops. For you guys to more understand loops is a instruction that is continuously repeated till it reach a certain condition. This week's lab contain 10 questions which need to be solved. Starting from first question we need to just show output for given code. I found that easy so there is no complaint about it :D. Second question need to trace the program by showing the values for each variable and write the output. Question 3 and 4 is simple cause its just about the loop writing for given code.

Question 5 is quite tricky cause it was divided into two that must convert given code for loop statement to a while and do-while loop.





After this I found question 9 was difficult. As usual I stucked here but managed to complete it with the guidance of my friends. This question I need to write a program that plays the popular rock-paper-scissor game. Actually the coding was quite lengthy that's why it was really tough for me. Luckily I've completed to run the program at last...☺☺



Finally the last tenth question also took sometime to solve it. I need to find the minimum point on the function f(x) = ( x – 2 ) 2 + 1 where x = [-1, 0, … , 4] using random optimization.



So yeah that is all for this week my dear friends. Even though things getting harder still I could manage to do my assignment with the guidance of my friends and my lecturer. You know self belief and hard work always earn you success. Till we meet next week with the new Lab assignment questions , take care..❤❤❤


THANK YOU FOR READING !!!

Pritah D/O Subramaniam (185797)




Next blog yanhua0112.blogspot.com

Friday, November 2, 2018

REFLECTION OF LAB 6


Good day people here I'm today to talk about my Lab assignment 6. Pheww...things are getting really harder man 😢. This week's topic is about Character and String. End of this lab we should able to Read strings and characters from the console. Furthermore, we also should able to declare and manipulate strings and character using methods provided by Character and String class. I would like to give a brief explanation about our today’s topic. 

“Char"
  1. One character
  2. Primitive type
  3. Notes the single quotes
  4. UTF-16 character 
  1. Zero or more characters
  2. A class
  3. Notes the doubles quotes 
  4. Can be thought as an array of chars
       
There were six questions given in this assignment. The first and second question was easy because the “System.out.println” was given and I just need to write complete java code to show the output. The third question, I should write an application that uses String method compareTo to compare two strings input by the user. Output should show whether the first string is less than, equal to or greater than the second.         
            
The fourth question need to write a program that displays a random lowercase letter using the Math.random() method.




The fifth question is to write a program that receives a character and displays its ASCII code (an integer between 1 and 127).



As usual the last question was a bit challenging for me where I need to write a program that prompts the user to enter a password and displays Valid Password if the rules are followed or Invalid Password otherwise.



That's the end guys .. Hope you all enjoy reading it. Till we meet again next week take care 💌.


THANK YOU FOR READING !!!

Pritah D/O Subramaniam (185797)


Next blog yanhua0112.blogspot.com