Uploaded by gozeel saeed

ITP Lab 1 (1)

advertisement
Riphah International University
Islamabad
LAB MANUAL
INTRODUCTION TO PROGRAMMING
FACULTY OF COMPUTING
1
Riphah International University, Islamabad
Faculty of Computing
Lab Manual Development
Supervision and Coordination
Dr. Tahira Nazir
Assistant Professor
Faculty of Computing
2
Riphah International University, Islamabad
Faculty of Computing
Table of Contents
Contents
1. Introduction ........................................................................................................................................ 5
2. Activity Time boxing ............................................................................................................................ 5
3. Lab Manual Lecture............................................................................................................................. 5
4. Objective ............................................................................................................................................. 6
6. Atom Installation................................................................................................................................. 6
7. Example Code ................................................................................................................................... 10
8. Practice Tasks .................................................................................................................................... 11
Task 1:
[Time Required: 10 minutes] ............................................................... 11
Task 2:
[Time Required: 10 minutes] ............................................................... 11
9. Evaluation criteria ............................................................................................................................ 11
10. Further Reading .............................................................................................................................. 11
3
Riphah International University, Islamabad
Faculty of Computing
Lab Manual for Introduction to Programming
Lab 1: Introduction and Installation of Atom
4
Lab 1: Introduction to Atom and
Installation
1. Introduction
JavaScript is a cross-platform, object-oriented scripting language developed by Netscape. JavaScript was
created by Netscape programmer Brendan Eich.
JavaScript is a programming language that adds interactivity to your website. This happens in games, in
the behavior of responses when buttons are pressed or with data entry on forms; with dynamic styling; with
animation, etc.
2. Activity Time boxing
Table 1: Activity Time Boxing
Task No.
Activity Name
Activity time
Total Time
1
Lecture
20 mins
2
Atom Installation
45 mins
3.
Example code
15 mins
180 Mins
4.
Walkthrough
20 mins
3 hour
5.
Write, Run and Compile 40 mins.
Task
6.
Problem Solving
3. Lab Manual Lecture
40 mins.
[Expected time = 20 minutes]
Variable
In JavaScript, let is a keyword that is used to declare a variable.
Variable Syntax
Here is the syntax to declare a variable using the let keyword:
1. let x =20;
2. let number = 61;
3. let name = “Mehwish”;
4. let subject = “Programming”;
OR
5. var x =20;
Console Log Method
You should use the console.log() method to print to console JavaScript. The JavaScript console log
function is mainly used for code debugging as it makes the JavaScript print the output to the console.
Console Log Method Syntax
console.log (12 + 3);
console.log(x);
Concatenation
let x="Hello "
let y="World"
console.log (x +y);
4. Objective
 Learn basic components of a JavaScript program.
 Learn the installation process of Atom.
 Learn the compilation process.
 Learn how to write, compile, and run simple JavaScript program.
 Learn how to initialise and use variables in JavaScript.
6. Atom Installation [Expected time = 45 minutes]
Step 1: Open https://atom.io/ in the browser
Step 2: Download Atom 1.60.0.
6
Step 3: Check in your Download. Click to install AtomSetup-x64.exe File in your system.
Step 4: Open the Atom.
Step 5: Go to File-> Setting and then click Install.
Step 6: Install Required Packages. Write Script in search bar and install script 3.32.2.
7
Try to install all these packages using search and install mechanism.
Step 7: Open New File and Save it as filename.js extension.
New File Creation:
8
Save File in .js extension:
Step 8: Run File using Script tag.
9
Download Node
https://nodejs.org/en/download/
Set Environment Variable
Go to environment variable: create new variable and the path of it.
7. Example Code [Expected time = 15 minutes]
Sample Program:
let x="Programming "
let y="World"
console.log (x+y);
Walkthrough: [Expected
time = 20 minutes]
Initialize two variables, name it firstName and lastName, Assign values to these variables and
Display Output on the screen.
10
8. Practice Tasks
Task 1:
[Time Required: 20 minutes]
Run Atom and create a new project.
Task 2:
[Time Required: 20 minutes]
Write the program which initialize two numbers add these numbers and Display Output.
9. Evaluation criteria
The evaluation criteria for this lab will be based on the completion of the following tasks. Each task is
assigned the marks percentage which will be evaluated by the instructor in the lab whether the student has
finished the complete/partial task(s).
No Evaluation will be done in this lab
10. Further Reading
The slides and reading material can be accessed from the folder of the class instructor available at
Moellim.
11
Download