C1002 Program Design Term 1 2008 assignment, part 2 final
This is the second part of my C1002 Term 1 2008 assignment, this post will contain my answer, while you can see the questions in the previous post.
Answer for question 1
JSP diagram:

Function List:
1. Initialize variables
2. Get the first letter
3. Capture the weight of the letter
4. Calculate postage value
5. Scan the stamp’s value
6. Send letter
7. Increase “paid letter” counter
8. Reject letter
9. Increase “underpaid letter” counter
10. Print output for current letter
11. Get next letter
12. Output Summary
13. End Program
Condition List:
1. C1 = Letter box not empty
2. C2 = Stamp value >= Postage value
Answer for question 2
Decision table for the college:
a) List of Conditions:
i. Student age less than 21.
ii. Student holds an IDCS qualification.
iii. Student has O level qualification with four credits.
b) List of Actions:
i. Enroll student for ADCS
ii. Enroll student for IDCS
iii. Enroll student for Entry test
c) Number of rules = R = 2c = 23 = 8
d) Decision Table:
e) Revised Decision Table:
From the table above, we can combine R1, R2, R5, and R6. In addition, we can also combine R7 and R8
The result
|
|
R1 |
R3 |
R4 |
R7 |
| Age less than 21? |
- |
Y |
Y |
N |
| IDCS qualification? |
Y |
N |
N |
N |
| O level with four credits? |
- |
Y |
N |
- |
| Enroll student for ADCS |
X |
- |
- |
- |
| Enroll student for IDCS |
- |
X |
- |
X |
| Enroll student for Entry test |
- |
- |
X |
- |
Answer for question 3
(a) Stages of SDLC (System Development Life Cycle):
2) System Analysis and Design
3) Program Design
4) Development
5) Testing
6) Implementation
7) Live Running and Maintenance
8) Review
(b) Explanation about each stage in SDLC:
1) Initial Study
In this stage, user tells the problem that exists to a system analyst. Then, the system analyst will conduct an initial study that will cover some issues such as what the problem is, is it possible to solve the problem, the benefit of the new system, and how much the time and cost needed to develop a new system to solve the problem.
The result of this SDLC stage is a feasibility report. This report contain information how the solution of the problem is feasible comparing the cost and the benefit of the solution.
Finally, the system analyst will show the feasibility report to the user because no further progress will made without any approval from the user. Once the user approves it, a system analyst can proceed to the next stage, System Analysis and Design.
2) System Analysis and Design
There are two main activities in this stage, Analysis and Design:
a) Analysis
The system analyst will analyze the new system’s requirements. To do this, a system analyst may use some techniques such as interview, polling, questionnaire, prototyping, etc. The objective is to find what the user needs the new system to do. All the information gathered by system analyst will be documented using tools like Data Flow Diagram (DFD) or Run Chart. This analysis activity will produce a requirement specification, which will verified by the user to confirm that the system analyst’s findings is correct.
b) Design
Based on the previous findings, the system analyst will design a system according to the user requirements. Using tools like DFD or System Flowchart, the result of this activity is a system specification. A System specification includes information like information flow, file storage organization, program’s requirements, and the outline of the user’s manual.
To make sure that the system specification is accurate, the user, manager, and the system analyst review this system specification. Once the user accepts this system specification, the system analyst can go to the next step of SDLC, Program Design.
3) Program Design
This stage of SDLC will produce a program specification. Program specification developed based on the system specification, which is the result of the previous stage.
A program specification consists of Program description and objectives, Input specification, Output specification, and the processing requirement and it developed by the system analyst or a senior programmer.
Tools used in this stage are Jackson Structured Programming (JSP), Pseudocode, Flowchart, or Decision Table. Tool used in a program design based upon the agreement on method used to do the program design.
4) Development
The main function of the development stage is to convert the program design into a workable solution, or in another words we can say that this stage is where the programmers write the actual programming codes.
Two main activities involved in this stage are:
- File Creation
- Application Program Creation
Besides those two main activities, there is another thing that needs to be done in this stage, that is documentation. Documentation is important since there are many file created in this stage. A proper documentation will help all the programmers and also the user to get better understanding about the developed system.
The documentation is done for Input and Output Specification, Data Dictionary, and Operating Instruction.
5) Testing
After the development stage, we continue with the testing and debugging stage. We have to take note that the main purpose in testing stage is to find the program’s error and to check whether the program worked according to the user’s requirements. It’s not just to prove that the program is working. Furthermore, we need to understand that it’s almost impossible to achieve a 100% error free program, so generally the aim is to achieve at least 95% error free program.
Program testing carried out based on the testing plan that has been prepared by the system analyst or senior programmer. If there are some errors discovered, changes could be made to the previous stages.
The results of testing stage are test log, test plan, test data, and test result.
6) Implementation
After the development and the testing stage have been carried out properly, now the new system is ready to be implemented. The system analyst will be the one who is responsible in this stage.
There are some actions covered in this stage:
- Release Documentation, to familiarize the user with the new system
- User Training, to give the user better understanding about the new system
- Data Conversion, to convert data from the old system to the new system
- Control procedures of changeover.
Additionally, there are some methods to do the changeover such as pilot changeover, parallel changeover, direct changeover, and phased/gradual changeover
7) Live Running and Maintenance
After successful implementation, now the new system is fully functional in daily activities. The program maintenance should be carried out to make sure that the system always runs in harmony with the company’s requirements. If there are some changes like change on government policy, change on business requirement, or there is a bug in the system, some modification to the system will need to be done. The modified program will need to be tested and new documentation needs to be produced.
8) Review
After the system has runs for a length of time, a review to the system is need to be carried out. This review is done by a person who doesn’t involved in the system development to make sure the objectivity of the review.
The review covers about how the system meets the objectives, cost, performance, standards, and recommendation for the system.
The review will be used to decide whether a maintenance needs to be done or the system will need to be re-designed. If in a case that the system needs to be re-designed, then the system analyst will conduct initial study, this process completes the System Development Life Cycle (SDLC).
Answer for question 4
(a) Explanation about Linear Search and Binary Search
1. Linear Search
Linear search is a sequential searching method. In linear search method, it will compare the search value with the first item or the first record in the list first. In this case, an index is used to point to the first record in the list. If the search value and the first record value is not equal, then it will continue comparing the search value with the next record, and keep going in sequence until it finds the value or until the end of the list if the search value is not found in the list.
- Advantages of Linear Search method
i. It is simple and easy to implement.
ii. It works fast if the search value mostly located in the beginning of a list.
- Disadvantages of Linear Search method
i. It will be very slow if the search is mostly at the end of the list or if the search is not on the list because it will need to check all the records in the list
ii. It is unproductive
2. Binary Search
Binary search is a more efficient searching method compared to the linear search method. In binary search, there are some steps done to search something in a list.
First, it will sort the records in the list (generally in ascending order). Second, it will compare the search value with the middle record. Third, if the search value is not equal with the middle record, it will see if the search value is greater or lesser than the middle record, if it greater than the middle record, then it will search on the greater half of the list and vice versa. With this method, the search area is reduced into half in every step, so the searching process will be fast.
- Advantages of Binary Search method
i. It is fast and efficient to search in a very long list
ii. It is faster than linear search
- Disadvantages of Binary Search method
i. It is more difficult and complicated than the simple linear search method
ii. It is less productive than linear search method when implemented on a short list
(b) Linear Search algorithm in pseudocode
Let’s assume that there are M numbers of records in the list, and n is the index value.
DO
SET n to 1
SET Isfound to false
Get first record
DO
WHILE (Isfound = false) and (n <= M)
IF numbArr[n] = target_record
THEN
Display (‘Number found at record number ‘, i)
Set Isfound to true
ELSE
Increase n by 1
ENDIF
ENDDO
IF (Isfound = false)
THEN
Display (‘Sorry, the number is not found.’)
ENDIF
ENDDO
(c) A sample program for binary search. (Using Java)
public class MyBinarySearch
{
public static void main(String[] args) throws Exception
{
int lowR=0, highR=5, middle=0;
boolean isfound = false;
char[] myArr = {‘T’, ‘H’, ‘O’, ‘M’, ‘A’,'S’};
System.out.print(“Please enter the character that you want to search: “);
char myChar=Character.toUpperCase((char)System.in.read());
System.in.read();
while (lowR<=highR && !isfound)
{
middle=(lowR+highR)/2;
if (myChar==myArr[mid])
{
System.out.println(“item no “+middle+ ” : “+ myArr[middle]);
isfound = true;
}
else
if (myChar<myArr[middle])
highR = middle – 1;
else
lowR = middle + 1;
}
if (isfound == false)
System.out.println(“Sorry, that character is not found.”);
}
}
(d) Bubble Sorting (In respect to Binary Search)
We have discussed before that the first step of a Binary Search is to sort the records in a list in ascending or descending order. We can use Binary Search only after the records are sorted, so we need a sorting method to sort the records in the list that is Bubble Sorting.
Bubble Sorting is a sorting method. It works by comparing the first record of the list to the second record, if they are not in correct order then interchange will occur, then it will continue by comparing the second record with the third record and so on, until it reaches the end of the list then it is considered as one pass. Bubble sort will go through few predetermined number of pass.
The advantage of using Bubble Sorting is that Bubble Sorting make use of efficient algorithm to sort data items less than 50.
Example of bubble sorting:
Assume that we have this array: MyArr = {D, C, A, E, B}
Then we want to sort our array in ascending order, then some pass will occur until the array is sorted properly:
1) First pass : C, A, D, B, E
2) Second pass : A, C, B, D, E
3) Third pass : A, B, C, D, E
The array is completely sorted after the third pass in this example, but in real bubble sort there is a predetermined number of pass, so even the data has been sorted, the bubble sort will keep checking each record until it reach the predetermined number of pass, this is the disadvantage of bubble sort that make it slow.
To overcome that problem, Improved Bubble Sorting is introduced. Improved Bubble Sorting use the same algorithm with Bubble Sorting but additionally it make use of flag to track down if there is any data interchange in a pass, if there is no data interchange that means the list has been sorted properly, then the sorting process will end there.
Do you have any comment on this? maybe you have something to ask me or want to discuss with me about this?Or maybe you are IDIC student and taking this module also?
Feel free to use the comment box below (click here if you cannot see the comment box).



Неплохо! [url=http://stroyregion.ru] [/url] [url=http://nerjmetall.ru] [/url] [url=http://altigen.ru]Спасибо за Ваш пост! [url=http://nerjmetall.ru] [/url] [url=http://womanmoda.ru] [/url] [url=http://vivienn.ru]
[/url] [url=http://medcenter-am.ru] [/url]
two main groups of factors affecting the choice of an implementation language in program design are selection of languages and practial/commercial issues.discuss these two factors which influence the choice of a programing language to be implemented in pre existing design.indicate which factors you consider to be the most important in practice and explain why.
explain what is meant by good programming style and explain why it is important
suppose that income tax is determined as follows:if income is less than $10,000 then there is no tax. for incomes between $10,000 and $30,000 the tax is 0.15 times (income 10000).for incomes greater than $30,000 the tax is 3000 plus 0.3 times (income 3000).write a program segment that inputs the amount of income from the user and prints ou the income tax on that amount. you do nt to write a complete program bt you should declare any variable that you use.(no limtatio to the use of any specific programming language)