IIT Bombay
Computer Programming
Prof. Deepak B Phatak
Prof. Supratik Chakraborty
Department of Computer Science and Engineering
IIT Bombay
Session: Introduction
1
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
IIT Bombay
Recap
• Computer is a machine
• It can operate only when a ‘program’ is given to it
• Program is a set of instructions
• Computer first reads and understand the entire program
• It then executes the instructions in specified order
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 2
IIT Bombay
Overview of This Lecture
• Instructions and Procedures
• A recipe for preparing Indian tea
• Procedure for a cashier in bank
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 3
IIT Bombay
Instructions, Procedures
• We often instruct people to do something
• Please get me a glass of water
• Please keep this book on the shelf
• Written Instructions are needed when
• A task is complex, needs many steps to be carried out
• Different people have to do the same task in exactly the same way
4
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
IIT Bombay
Recipe for preparing Indian Tea
• Take a cup of water in a vessel
• Add two teaspoons sugar, one teaspoon tea leaves, milk
• Boil for 3 minutes
• Strain into a tea kettle
• Serve in a cup
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 5
IIT Bombay
(Wrong) Recipe for preparing Indian Tea
• Take a cup of water in a vessel
• Boil for 3 minutes
• Add two teaspoons sugar, one teaspoon tea leaves, milk
• Strain into a tea kettle
• Serve in a cup
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 6
IIT Bombay
Quiz
You will serve (a) Good Indian Tea (b) Hot water
(c) Some funny looking mixture (d) None of these
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 7
IIT Bombay
Analysis of the Quiz answers
• Since the water was not boiled with all ingredients, you will
certainly not get the Good Indian Tea. (a) is wrong
• You did add ingredients just before straining, so you will not
have plain hot water definitely. (b) is wrong
• Some colour from tea leaves, and some sweetness from
Sugar will be added. (c) is correct
• Since (c) is correct, (d) is obviously incorrect
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 8
IIT Bombay
A Banking Procedure
• An Old Bank maintains account information in ‘Ledgers’
• Customer comes to withdraw money from account
• Presents a cheque or a withdrawal-slip
• Should be paid cash if balance is adequate
• Appropriate entries must be made in the ledger
• A written procedure is used by the cashier
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 9
IIT Bombay
A job-card for Bank Cashier
• Greet the customer and collect the instrument presented.
• Keep the instrument on your right, and keep a paperweight
on it.
• Check balance in Account ledger
• Write a 'debit' entry in the ledger, update balance amount
• Count cash, and hand it over to the customer.
• Thank the customer for banking with your bank.
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 10
IIT Bombay
Summary
• A written procedure
• Must be first fully read and understood
• Then all steps must be executed in the specified order
Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 11

CS101x_S002_Introduction_IIT_Bombay-1.pdf

  • 1.
    IIT Bombay Computer Programming Prof.Deepak B Phatak Prof. Supratik Chakraborty Department of Computer Science and Engineering IIT Bombay Session: Introduction 1 Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
  • 2.
    IIT Bombay Recap • Computeris a machine • It can operate only when a ‘program’ is given to it • Program is a set of instructions • Computer first reads and understand the entire program • It then executes the instructions in specified order Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 2
  • 3.
    IIT Bombay Overview ofThis Lecture • Instructions and Procedures • A recipe for preparing Indian tea • Procedure for a cashier in bank Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 3
  • 4.
    IIT Bombay Instructions, Procedures •We often instruct people to do something • Please get me a glass of water • Please keep this book on the shelf • Written Instructions are needed when • A task is complex, needs many steps to be carried out • Different people have to do the same task in exactly the same way 4 Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay
  • 5.
    IIT Bombay Recipe forpreparing Indian Tea • Take a cup of water in a vessel • Add two teaspoons sugar, one teaspoon tea leaves, milk • Boil for 3 minutes • Strain into a tea kettle • Serve in a cup Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 5
  • 6.
    IIT Bombay (Wrong) Recipefor preparing Indian Tea • Take a cup of water in a vessel • Boil for 3 minutes • Add two teaspoons sugar, one teaspoon tea leaves, milk • Strain into a tea kettle • Serve in a cup Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 6
  • 7.
    IIT Bombay Quiz You willserve (a) Good Indian Tea (b) Hot water (c) Some funny looking mixture (d) None of these Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 7
  • 8.
    IIT Bombay Analysis ofthe Quiz answers • Since the water was not boiled with all ingredients, you will certainly not get the Good Indian Tea. (a) is wrong • You did add ingredients just before straining, so you will not have plain hot water definitely. (b) is wrong • Some colour from tea leaves, and some sweetness from Sugar will be added. (c) is correct • Since (c) is correct, (d) is obviously incorrect Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 8
  • 9.
    IIT Bombay A BankingProcedure • An Old Bank maintains account information in ‘Ledgers’ • Customer comes to withdraw money from account • Presents a cheque or a withdrawal-slip • Should be paid cash if balance is adequate • Appropriate entries must be made in the ledger • A written procedure is used by the cashier Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 9
  • 10.
    IIT Bombay A job-cardfor Bank Cashier • Greet the customer and collect the instrument presented. • Keep the instrument on your right, and keep a paperweight on it. • Check balance in Account ledger • Write a 'debit' entry in the ledger, update balance amount • Count cash, and hand it over to the customer. • Thank the customer for banking with your bank. Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 10
  • 11.
    IIT Bombay Summary • Awritten procedure • Must be first fully read and understood • Then all steps must be executed in the specified order Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, IIT Bombay 11