Introductory Computer Sciences

Slides:



Advertisements
Similar presentations
CE 311 K Introduction to Computer Methods VB Controls and Events Daene C. McKinney.
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
How Are Algorithms Developed?
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
1.4 Programming Tools Flowcharts Pseudocode Hierarchy Chart
Chapter 1 - An Introduction to Computers and Problem Solving
Introduction to Programming
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
زبانهای برنامه سازی برنامه سازی پیشرفته ارائه دهنده دکتر سيد امين حسيني E.mail: Home page:
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2- Visual Basic Schneider
Programming Tools Flowcharts Pseudocode Algorithm Chapter 2.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
The Program Development Cycle and Program Design Tools
Computers: Tools for an Information Age
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
The Program Design Phases
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Introduction to Computers and Programming
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development.
IE 212: Computational Methods for Industrial Engineering
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
Simple Program Design Third Edition A Step-by-Step Approach
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
PROBLEM SOLVING The first step in writing instructions to carry out a task is to determine what the output should be (What should the task produce?)
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: An Introduction to Programming Using Visual Basic 2012, All Rights ReservedAn Introduction.
Chapter 2 - VB.NET by Schneider1 Chapter 2 - Problem Solving Program Development Cycle Programming Tools.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
BACS 287 Programming Logic 1. BACS 287 Programming Basics There are 3 general approaches to writing programs – Unstructured – Structured – Object-oriented.
Flowcharts. Problem Solving Computer programs are written to solve problems or perform tasks Programmers translate the solutions or tasks into a language.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
Chapter 11 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
Introduction to Computing Dr. Nadeem A Khan. Lecture 2.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Expressing Algorithms as Flowcharts and Pseudocode
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
 Problem Analysis  Coding  Debugging  Testing.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Management Information System Section (211 NMA course) Introduction to Programming.
Visual Basic Programming Introduction to Computers Programming.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Chapter 2- Visual Basic Schneider
Introduction to Computing
Lecture 2 Introduction to Programming
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Chapter 2- Visual Basic Schneider
Flowcharts and Pseudocode
Basic Concepts of Algorithm
Programming Logic and Design Eighth Edition
Presentation transcript:

Introductory Computer Sciences YILDIZ TECHNICAL UNIVERSITY Introductory Computer Sciences ASST. PROF. DR. cenk budayan

Email: budayan@yildiz.edu.tr ve YARBİS http://www.yarbis.yildiz.edu.tr/budayan Office Hours: Monday 14:00 – 16:00 Wednesday 15:00-17:00 Office: 1-064

How we communicate with the computer Machine Language (Lowest Level) 00010001111010111100011111000111111 Symbolic Language Low Level Programming Languages: It is close to the machine language. It converts to the machine language by using a small program, therefore it is faster than the high level programming languages (assembly). High Level Programming Languages: It consists of instructions to which people can relate, such as Click, If, and Do. (Visual Basic, C, C++, Java)

High Level Programming Languages Description Visual Basic, C# Popular programming languages for building windows and web applications. Use a graphical user interface C, C++ Powerful advanced programming languages that emphasize flexibility and fast running times. C++ is also object oriented. Java Flexible and powerful programming language that runs on many different computer systems. Often used to teach object-oriented programming Python Simple, yet powerful programming language used for graphics and small applications PHP Programming language used for creating interactive Web sites JavaScript Scripting language used in Web applications that provides rich used interfaces for Web Browsers.

Object oriented programming Is an industry standard model for designing and coding programs. When designing applications, designers use real-world objects to express patterns, called classes in software. For example, a student registration application: Students and transcripts as possible classes Classes contain attributes, expressed as variables. For example, student class can have attributes such as Student ID, name, surname

Graphical User Interface (GUI) User Friendly. Simplified interaction with the computer. Not simplified the task of programming. Require on-screen elements such as windows, dialog boxes, buttons and menus. Uses mouse for interaction. No longer does the user respond to a program – now the program responds to a user.

Visual Basic Visual Basic (VB) is one of the programming environment which can be used for performing many purposes easily. In the early 1960s, two mathematics professors at Dartmouth College developed a programming language called BASIC to provide their students with an easily learned language that could tackle complicated programming projects. As the popularity of BASIC grew, refinements were introduced that permitted structured programming, which increased the reliability of programs. Visual Basic 1.0 is a graphical version of BASIC developed in 1991 by the Microsoft Corporation to allow easy, visual-oriented development of Windows applications.

Visual Basic VB is not only limited with programming, but also it can be used for developing programs in MS Office (Excel, Word, Powerpoint and Outlook Express) via Visual Basic Application(VBA). VBScript used for developing Web applications is one of the subsets of VB. VB can be used for programming for many different objects. It varies for a small program to a web application which can be used by the entire world. As you can understand, VB is a simple however a powerful language.

Installation of Visual Basic http://www.visualstudio.com/en-us/downloads/

Programming Programming: creating a sequence of instructions to enable the computer to do something. Program: is a set of instructions a computer follows in order to perform a specific task. A program can consist of one or two command lines or can consist of million command lines. For example; Windows operating system is written with millions of command lines, on the other a tax program can be formed of two command lines.

Program Computers are designed to follow instructions. These instructions are called an algorithm. An algorithm is a set of well-defined steps for performing a task or solving a problem. These steps should be sequentially ordered. The computers can only follow the instructions and they do not evaluate these instructions and examine whether these instructions are logic or not.

Procedure Input Process Output

Performing a task on the computer The first step in writing instructions to carry out a task is to determine what the output should be —that is, exactly what the task should produce. The second step is to identify the data, or input, necessary to obtain the output. The last step is to determine how to process the input to obtain the desired output – that is, to determine what formulas or ways of doing things should be used to obtain the output.

Example How fast is a car moving if it travels 50 miles in 2 hours The type of the answer requested. (speed) The information needed to obtain the answer. (distance and time) The procedure required to obtain the answer by using the available information. (distance / time)

Example Price* 0,18 Price of the product Tax Finding the tax for a product. (tax: 18% of the price of the product) Price of the product Price* 0,18 Tax

Program planning Software Development Cycle Analyze: Define the problem Design: Plan the solution to the problem. Design the interface: Select objects (text boxes, buttons etc.)

Program planning Code: Translate the algorithm into a programming language. Test and correct: Locate and remove any errors in the program. Complete the documentation: Organize all the material that describes the program.

Example Calculate the gas mileage which is the number of miles traveled divided by the number of gallons of gas used. Therefore, your program needs to compute the number of miles traveled since the last fill-up, and the number of gallons used during this period. Let’s suppose that you always fill up the gas tank. Therefore, the amount of gas that you put in the car is the amount used since the last fill-up.

Example To compute the number of miles you need to subtract the odometer reading at the last time you filled up the tank from the odometer reading at this filling time. This means that you need to have saved the odometer reading from the last time you filled up. Suppose you have done so by writing the odometer reading and storing it in your glove compartment. Therefore, the inputs to your procedure are: The current odometer reading The amount of gas pumped

First Solution 1. Read odometer value. 2. Subtract previous odometer value from the current odometer value to obtain the number of miles traveled. 3. Divide by the number of gallons of gas pumped to determine the mileage

Second Solution 1. Read the current odometer value. 2. Write the odometer value obtained in step 1 on a piece of paper 3. Retrieve the previous value from the glove compartment. 4. Store the paper from step 2 in the glove compartment. 5. Subtract the value obtained in step 3 from the value obtained in step 1. 6. Fill the tank. 7. Read the number of gallons pumped. 8. Divide the number obtained in step 5 by the number obtained in step 7. 9. Display the number obtained in step 8 as the mileage. 10. Stop.

Third Solution 1. Read the current odometer value. 2. Write the odometer value obtained in step 1 on a piece of paper. 3. Is this the first time for this procedure? (a) If the answer is yes, (i) Store the paper from step 2 in the glove compartment. (ii) Stop. (b) If the answer is no, retrieve the previous value from the glove compartment. 4. Store the paper from step 2 in the glove compartment. 5. Subtract the value obtained in step 3(b) from the value obtained in step 1. 6. Fill up the tank. 7. Read the number of gallons pumped. 8. Divide the number obtained in step 5 by the number obtained in step 7. 9. Display the number obtained in step 8 as the mileage. 10. Stop.

Fourth Solution 1. Read the current odometer value. 2. Write the odometer value obtained in step 1 on a piece of paper. 3. Is there a previous odometer reading in the glove compartment? (a) If the answer is no, (i) Store the paper from step 2 in the glove compartment. (ii) Stop. (b) If the answer is yes, retrieve the previous value from the glove compartment. 4. Store the paper from step 2 in the glove compartment. 5. Subtract the value obtained in step 3(b) from the value obtained in step 1. 6. Fill up the tank. 7. Read the number of gallons pumped. 8. Divide the number obtained in step 5 by the number obtained in step 7. 9. Display the number obtained in step 8 as the mileage. 10. Stop.

Programming tools Pseudocode: Uses English-like phrases with some Visual Basic terms to outline the task. Flowcharts: Graphically depict the logical steps to carry out a task and show how the steps relate to each other. Hierarchy charts: Show how the different parts of a program relate to each other.

Programming tools You decide to mail a letter, however you must decide how much postage to put on the envelope. One rule of thumb is to use one stamp for every five sheets of paper. Suppose a friend asks you to determine the number of stamps to place on an envelope.

Flowchart Symbol Name Meaning Flowline Used to connect symbols and indicate the flow of logic Terminal Used to represent the beginning or the end of a task Input/Output Used for input and output operations, such as reading and displaying. The data to be read or displayed are described inside. Process Used for arithmetic and data manipulation operations. The instructions are listed inside the symbol. Decision Used for any logic or comparison operations. Unlike the other symbols, the decision symbol has one entry and two exits. Connector Used to join different flowlines Annotation Used to provide additional information about another flowchart symbol

Flowchart

Pseudocode Pseudocode is an abbreviated plain English version of actual computer code The geometric symbols used in flowcharts are replaced by English-like statements that outline the process. As a result, pseudocode looks more like computer code than does a flowchart. Pseudocode allows the programmer to focus on the steps required to solve a problem rather than on how to use the computer language. The programmer can describe the algorithm in Visual Basic- like form without being restricted by the rules of Visual Basic.

Pseudocode Read sheets number (input) Set the number of stamps to Sheets (sheets/5) (process) Round the number of stamps up to the next whole number (process) Display the number of stamps(output) Advantages It is compact and probably will not extend for many pages as flowcharts commonly do. Also, the plan looks like the code to be written and so is preferred by many programmers.

Hierarchy Chart shows the overall program structure. depict the organization of a program but omit the specific processing logic. describe what each part, or module, of the program does and they show how the modules relate to each other. The details on how the modules work, however, are omitted. The chart is read from top to bottom and from left to right. Each module may be subdivided into a succession of submodules that branch out under it. The main benefit of hierarchy charts is in the initial planning of a program. We break down the major parts of a program so we can see what must be done in general. From this point, we can then refine each module into more detailed plans using flowcharts or pseudocode. This process is called the divide-and-conquer method.

Round stamps up to next whole number Hierarchical Chart Postage stamp program Read sheets Calculate stamps Set stamps= sheets / 5 Round stamps up to next whole number Display stamps

Decision Structure

Repetition Structure

Homework Calculate and report the average grade for a class. Output: Average grades Input: Student grades Process: Find the sum of the grades, count the number of students, calculate the average grade = sum of grades / number of students Draw the flowchart of this program.