1 / 29

INTRODUCTION TO PROGRAMMING

INTRODUCTION TO PROGRAMMING. Program Development Life Cycle. The program development life cycle is a model that describes the stages involved in a program development project, from an initial feasibility study through maintenance of the completed program.

chandler
Download Presentation

INTRODUCTION TO PROGRAMMING

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INTRODUCTION TO PROGRAMMING

  2. Program Development Life Cycle • The program development life cycle is a model that describes the stages involved in a program development project, from an initial feasibility study through maintenance of the completed program. • The program development life cycle can be summarized as: • Analysis • Design • Testing • Implementation • Maintenance

  3. Analysis In this phase the existing system is evaluated. Deficiencies are identified. This can be done by interviewing users of the system and consulting with support personnel. The new system requirements are defined. In particular, the deficiencies in the existing system must be addressed with specific proposals for improvement.

  4. Design The proposed system is designed. Plans are laid out concerning the hardware, operating systems, programming, communications and security issues. The new system is developed. The new components and programs must be obtained and installed.

  5. Testing Once the new system is developed, all aspects of performance must be tested. Testing should ensure that the system not only responds correctly to valid data but also deals with invalid data. If necessary, adjustments can be made at this stage.

  6. Implementation The new system is put into use. The new system can be phased in, according to application or location and the old system gradually replaced. In some cases, it may be more cost-effective to shut down the old system and implement the new system all at once. Users of the new system must be trained in its use.

  7. Maintenance Once the new system is up and running for a while, it should be exhaustively evaluated. Maintenance must be kept rigorously at all times. Users of the system should be kept up-to-date concerning the last modifications and procedures.

  8. ANALYSIS AND ALGORTIHM DESIGN - I

  9. Analyzing the problem • In order to write a program to accomplish a certain task you must analyze the task as a sequence of instructions that can be performed by the computer. • These instructions can be divided into three main parts: • Input and Storage Instructions • Processing Instructions • Output Instructions

  10. Input and Storage instructions These instructions allow data to be accepted by the computer. The input is information that is needed by the computer to solve the problem. Words such as ‘Enter’, ‘Input’ and ‘Read’ within problem statements usually indicate what data the computer requires.

  11. Input and Storage instructions • Example 1 • What are the input and storage instructions here? • Read the price of an item and calculate the discount of 10%. • Enter the name and year of birth of a person and calculate the person’s age. • Input the length of a side of a square tile and find the area.

  12. Input and Storage instructions • Let’s analyze these instructions to determine the • inputs and what we need to store. • Read and store the price of an item • 2) Enter the name and year of a birth of a person • 3) Input the length of the side of a square tile

  13. Processing instructions These instructions manipulate the input data. They involve calculations that is, mathematical operations (e.g. addition, subtraction, multiplication and division), repeating instructions, selecting instructions and comparison instructions. They also include commands and constructs.

  14. Processing instructions A command is a word that instructs the computer what must be done to accomplish a specific task. Commands are specific to a particular programming language: for example WRITE, PRINT, READ, INPUT etc.

  15. Processing instructions A construct is a group of instructions that work together with commands to accomplish a specific task. An example is the ‘IF-THEN’ construct: Example: IF a < 10 THEN READ Num ENDIF

  16. Processing instructions Problem statements that contain the words ‘calculate’, ‘compute’, ‘convert’, ‘add’, ‘sum’, ‘subtract’, ‘minus’, ‘multiply’, ‘divide’, ‘percentage’, ‘average’, indicate what needs to be done. Problem statements can also imply what needs to be processed by looking at what results are required for output. For example : Print the area of the room’.

  17. Processing instructions • Example 2 • What are the processing instructions here? • Read the price of an item and calculate the new price after a 10% discount. • 2) Enter a temperature in degrees Celsius and convert it to degrees Fahrenheit. • 3) Input the name and year of birth and compute and print the age of a person.

  18. Processing instructions • Let’s analyze these instructions to determine • what we need to process. • Calculate the new price after a 10% discount. • 2) Convert it to degrees Fahrenheit. • 3) Compute the age of a person.

  19. Processing instructions Comparison statements and repeat statements Comparison/selection/decision statements involve determining whether a condition is true or false in order to perform a set of instructions.

  20. Processing instructions Comparison statements and repeat statements For example: Read the weekly hours worked by an employee. If the hours worked are greater than 40, then calculate overtime salary at 1.5 times the standard hourly rate of $8.50, for those over 40. The condition that is checked is the number of hours worked to determine if it is more than 40.

  21. Processing instructions Comparison statements and repeat statements Repeat statements/loopings/iterations are used when a problem has to be done a number of times. For example: Read the marks for three subjects, English, Maths and Spanish, for each student; find the average mark of each student in a class of 15, over the three subjects. The process of finding the average for the three subjects has to be repeated 15 times.

  22. Output instructions • These instructions allow information to be • displayed on the screen. Problem statements that • include key words like ‘print’, ‘output’, • ‘display’, ‘return’ and ‘write’, indicate what data • should be output to the screen. • Example 3 • What are the output statements here? • Enter the name and year of birth of a person and compute and display the age of the person. • Write an algorithm to print a conversion table of °C to °F, 10°C to 20°C inclusive.

  23. Output instructions • Let’s analyze these instructions to determine what • we need to output. • Display the age of the person • 2) Print a conversion table

  24. Examples Let’s analyze a few problems. Example 4 Write a program to enter the base and the height of a triangle and find and print the area.

  25. Examples Example 5 Write a program to read the temperature in degrees Celsius (°C) and convert it to degrees Fahrenheit (°F) where F=32+(9C/5). Output the temperature in degrees Celsius and Fahrenheit.

  26. Examples Example 6 Write a program to read the answer to the sum 10*12. (The answer is 120.) Return the comment “Correct” if the answer is right and “Incorrect” if the answer is wrong.

  27. Examples Example 7 Write a program that reads the result of 10 games played by a team and find the percentage of games won by the team. Output the percentage games won.

  28. Examples Example 8 A school has a house system implemented. Points are awarded to a house based on the performance of its members. 1st place – 4 points, 2nd place – 3 points, 3rd place – 2 points, 4th place - 1 point, and last place – no points awarded. Read the names of 10 members of the Aripo house and the place they came on the events; calculate and print the total points awarded to the house.

  29. Examples

More Related