Programming Fundamentals Lab Manual 01

Statement Purpose:

The objective of this lab is to make student familiar with basic programming concepts using flowcharting techniques.

Activity Outcomes:

This lab teaches you the following topics:
  • An introduction to Raptor Tool
  • Basic flowchart Symbols
  • Creating, Running and Saving flowcharts in Raptor

1) Stage J (Journey)

Introduction:

Make yourself familiar with the Raptor Tool
1.1         Understand the symbols for Input, Process and Output
1.2          Placing symbols and saving your first flowchart
1.3          Running the flowchart and getting the output in console
Making program flowcharts is a powerful technique for logic building and learning syntax free programming. Using Raptor, a GUI based drag and drop tool you can easily test your logic building skill, just drape your logic with the syntax of any programming language and claim yourself to be a programmer.

2) Stage a1 (apply)

Lab Activities:

Activity 1:

Create flowchart for “Hello World”

Solution:

Launch Raptor, you will see two set of windows, the main working pane and the console window.
The main window is where you can drag and drop symbols and test your logic while the console window gives you output and some basic information regarding the last execution done.

Task 1.1: Hello World and it’s Execution

➜ Pick the output symbol from symbols pane and drag it in between the start and end symbol, the application might ask you to save your work, give it a meaningful name like HelloWorld and it will be saved with rap extension.
➜ Single click inside the output symbol to select it.
➜ Double click inside the output symbol and you will see a popup window asking what you want to output.
➜ In the output popup window type (with double quotes) “Hello World”.
➜ You can optionally change the speed of execution using the scrolling pointer given immediately after the buttons toolbar.

Activity 2:

Flowchart for calculating Area of Circle

Solution:

The formula to calculate area of circle is
Area = 3.1415 * radius * radius
It’s clear that the only variable in the above formula is “radius” of the circle, this means we require it as an input from user to get a meaningful answer of the expression.
➜ Select the New option from File menu
        • Place the Input Symbol from the list of symbols.
        • Place the Assignment Symbol just below the Input Symbol.
        • Finally place an Output Symbol after the Assignment and just before the End Symbol.
➜ Double click on the input symbol and tell the
Raptor the message you want to display in the Prompt section and the variable name in which you want to store the input from the user.
➜ Double click the Assignment Symbol and introduce a new variable named “area” in the Set field and the formula for expression in the “to” field.
➜ Double click the Output Symbol and tell the Raptor what you want to display as output, the literal message in double quotes concatenated with the plus symbol and the variable whose value you want to display.
“The Area of Circle with Radius ” + radius + ” is ” + area
 ➜ Execute the flow chart, give the required input for “radius” and verify the output.

3) Stage v (verify)

Home Activities:

  1. Create a flowchart that prompts the user to enter two points (x1, y1) and (x2, y2) and displays their distance between them. The formula for computing the distance is sqrt((x2 – x1)2 + (y2 – y1)2). Note that you can use the built-in method sqrt(x) for calculating square root of a given number.
  2. Given an airplane’s acceleration a and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula: length = (v * v)/(2*a)
Draw a flowchart that prompts the user to enter v in meters/second and the acceleration a in meters/second squared and displays the minimum runway length.

4)    Stage a2 (assess)

Lab Assignment and Viva vice

Statement Purpose:

The objective of this lab is to make student understand the basic concepts of selection and looping using flow charting technique in Raptor.

Activity Outcomes:

This lab teaches you the following topics:
  • At the end of this lab student will know how to develop logic of a program
  • Students will get clear understanding of two important Problem-Solving techniques which are:
                      • Selection
                      • Iteration or Looping

Comments

Popular posts from this blog

Programming Fundamentals Lab Manual 13

Programming Fundamentals Lab Manual 04

Programming Fundamentals Lab Manual 12