There were eight questions given in this assignment. Question one until four I was able to do cause we just need to trace the programs and show their output. I didn't found that hard because i have done that before in my previous assignment. Questions five till eight I found them really hard where we need to write a program for each situation given.
Question 5
For this question we need to write a program that prompts the user to enter a letter in the alphabets. Later on, the program will display the letters before and after of the specified letter. We were given letter 'g' in the sample run. Here I have applied the "char" data type which represents a single character thought by our beloved lecturer Dr.Erzam. As usual I have encountered some errors throughout coding the program which I have misplaced the quotation marks but eventually I managed to correct it :).
Question 6
This question is more to calculating distance using (x1, x2, y1 and y2). I have used double data type which are math.pow and math.sqrt to solve this question. Actually by using various types of data for each question helps me to answer and learn more on how to identify each data type.
Question 7
Since I am a slow learner I found this question abit hard for me. Just took sometime to understand what it really wants. We need to prompt the user to enter 0 to convert from USD to RM and 1 to convert from RM to USD. Again prompt the user to enter the amount in USD or RM to convert it to USD or RM respectively. With the guidance of lecturer and my friends I could able to type the coding to run the program. A very big thanks to them :)
Question 8
Question one was the most challenging question for me. The program prompts the user to enter a number 0, 1 or 2 and displays a message indicating whether the user or the computer wins, loses or draws. 0, 1, and 2 represent rock, paper and scissor respectively.
So that's the end of this week's lab assignment. Even though I successfully completed running the program I still need many more practices on this so that I could manage to do it on my own for the next time. This kind of challenging questions actually helping me to explore the possibilities of my mind and no matter what I will keep trying and could able to find a way to solve it at last.
That's all for today peeps. Have a Nice Day Ahead.
Muchas Graciasss :) !!!
Pritah D/O Subramaniam (185797)
Next blog : yanhua0112.blogspot.com
No comments:
Post a Comment