For Lab1,we were supposed to;
1.Identify common errors and programming pitfalls.
2.Designing solution to a problem using Program Analysis Chart.
3.To write,compile,run a simple computer program based on Program Analysis Chart.
Into The Lab
For this Lab1,for the first part we were given class to be separated in java class and we need to the errors.Below are few examples of class of java that we need to fix the error.
One of the problem when I tried to run the java program for test 4.The java run smoothly but the answer to the question is not correct.The value of 5 divided by 2 is supposed to be 2.5 but it display only 2.This is because we use integer,so what we fix to get the value 2.5 is by replacing the integer with the double so,it can give the greatest value of divider.
Test4. |
The other error that I found is in Test9 that is the logic error.Where the question we were asked to solve were 1 divided by zero.It is obviously a logic error where 1 divided by zero is 0.
Test 9 |
For the Program Analysis Chart,there were few steps need to be taken to solve the problem:
Below are the example from the lab1 for Problem Analysis Chart:
From this Lab1,we are able to find the common error,solve problem using Problem Analysis Chart and we able to write,compile,run a simple computer program based on Program Analysis Chart.
Link to Dinie;s blog;
No comments:
Post a Comment