Hi everyone! - This the continuous of my previous post regarding to the lab task. So, I'm gonna share how I start my second week of this course. Last Thursday I was given task on identifying common errors and programming pitfalls, designing solution to a problem using Problem Analysis Chart and to write, compile and run a simple computer program based on PAC. Basically, this is the main task for this Lab 1 's task. So, three main questions was given to us and we are required to solve all the problems given.
The main theory we need to apply for this task is Problem Analysis Chart. In order for us to solve all the problems, the first step that must be done is analyze or identify the problem. The function of this Problem Analysis Chart is it can helps you to pull out all the information in the problem and transform it into the table form. From there, you can write down all those things in the java program easily when you can identify the problems clearly. The question one is began with where you need to write down the coding according to the question in the java program. After done write all the coding, the next step is compiling the coding and identify the error. In this case, you need to identify the error precisely and fix the error until you succeed compiling it. After done compiling it, you need to run it in order for you to see the result whether it is same as what you command or not. From my observation, what I can say here, if you can run the program doesn't means that it is 100% correct. Sometimes the result that you get might be not the same as what you command the program to do for you. Total number of test that we need to run is 12 tests and each test has different types of error. From my point of view, after done all the 12 tests, it makes me become more familiar with the errors and I can identify the given coding whether it has error or not easily. Practice makes perfect. Below is the solution for Question 1:
Let's Begin!!!
Test7
Test8
Test9
Let's Begin!!!
Test1
Below is the coding for test 1. What I need to do is typing all the coding in the windows prompt and compile by using java program. After done all the steps, i found that there is an error in the coding. For example, there is missing word of "static" in the middle of "public" and "void" in the sentences.
Below is the coding for test 1. What I need to do is typing all the coding in the windows prompt and compile by using java program. After done all the steps, i found that there is an error in the coding. For example, there is missing word of "static" in the middle of "public" and "void" in the sentences.
After I fix the error, here is the right coding for above test.
I repeated the same way for all test.
Test2
Answer:
Test4
Answer:
Test5
Answer:
Answer:
Test7
Answer:
Test8
Answer:
Test9
Answer:
CelsiusToFahrenheit
Answer:
After that, the second question is about to analyse the problems by using Problem Analysis Chart. There are about 3 sub-question with around 2 to 3 sentences and what I need to do is read the sentences carefully, identify the problem and write down in Problem Analysis Chart. This part is quite easy but the way to write down in Program Analysis Chart is important so that other people can easy to understand the message we are trying to convey without feeling confuse. Below is the solution for Question 2:
Data
|
Processing
|
Output
|
Acre of land in square feet.
|
Calculate number of acres in a tract of a land.
|
Total acres for a land with 389,767
square feet.
|
Data
|
Processing
|
Output
|
Test scores
|
Calculate average test scores.
|
Average of three test scores.
|
Data
|
Processing
|
Output
|
Percentage of profit.
|
Calculate retail price of a circuit
board
Calculate the amount of profit
earned for that product.
|
The retail price of a circuit board.
The amount of profit earned for that
product.
|
The third question is little bit combination of first and second question. This question required me to identify the problem first by using Problem Analysis Chart (PAC) and after that write down the coding in the notepad and compile and run the coding by using java program.
Data
|
Processing
|
Output
|
Airplane’s length for take-off speed.
Airplane’s acceleration.
|
Calculate runway length needed for
an airplane to take off
|
Length for an airplane to take off.
|
This task has strengthen my knowledge in identifying the errors, identify the problems and create the coding based on the given problem by my own self. It is very useful!
Nursaidatul Sakinah Binti Saharuddin
184881
Enjoy reading my blog!
Feel free to share any fruitful knowledge with me as I am eager to learn something new and we can learn together!
Thank you :)
This is my friend's blog. Check him out!
hongjing96.blogspot.com (lLim Hong Jing )