I101/B100 Problem Solving with Computers

Similar documents
I101/B100 Problem Solving with Computers

Object Oriented Programming with Visual Basic.Net

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Chapter 8 Algorithms 1

Low-Level Languages. Computer Programs and Programming Languages

A201 Object Oriented Programming with Visual Basic.Net

Introduction Objectives: 1) differentiate between high-level, low-level, and machine language; 2) explain why it is necessary to translate a program

Unit II. (i) Computer Programming Languages

Accelerator pack Summer 2018

Geometry Surface Area and Volume of Spheres.

Algorithms. Chapter 8. Objectives After studying this chapter, students should be able to:

I101/B100 Problem Solving with Computers

Chapter 1: An Overview of Computers and Logic

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Python - Week 1. Mohammad Shokoohi-Yekta

5th Grade Mathematics Essential Standards

Archdiocese of Washington Catholic Schools Academic Standards Mathematics

Lecture 1 - Introduction (Class Notes)

Introduction to Computer Programming Using FORTRAN 77

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

gg--c}/-/j) r x Revision: New: COBOL I TWO Date: Author: Date SAULT COLLEGE OF APPLIED ARTS & TECHNOLOGY SAULT STE. MARIE, ONTARIO

Fundamentals of Computing and Digital Literacy. Sample. Marking Scheme

Copyright 2005 Department of Computer & Information Science

Programs as Models. Procedural Paradigm. Class Methods. CS256 Computer Science I Kevin Sahr, PhD. Lecture 11: Objects

Technology in Action. Alan Evans Kendall Martin Mary Anne Poatsy. Tenth Edition. Copyright 2014 Pearson Education, Inc. Publishing as Prentice Hall

8 Algorithms 8.1. Foundations of Computer Science Cengage Learning

Java and Software Design

(6.6) Geometry and spatial reasoning. The student uses geometric vocabulary to describe angles, polygons, and circles.

SENIOR HIGH MATH LEAGUE April 24, 2001 SECTION I: ONE POINT EACH

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

STAAR Category 3 Grade 8 Mathematics TEKS 8.6A/8.6B/8.7A. Student Activity 1

Technology in Action. Chapter Topics. Scope creep occurs when: 3/20/2013. Information Systems include all EXCEPT the following:

Computer Programming-1 CSC 111. Chapter 1 : Introduction

2007 Canadian Computing Competition: Senior Division. Sponsor:

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

Lesson 01 Introduction

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Name Date Class Practice A

Unit: Rational Number Lesson 3.1: What is a Rational Number? Objectives: Students will compare and order rational numbers.

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1

Programming. leads to programming languages. leads to operating systems

Arrays. Storing Multiple Values

Course Outlines. Elementary Mathematics (Grades K-5) Kids and Numbers (Recommended for K-1 students)

Measurement Unit. This booklet belongs to:

Unit 1: Area Find the value of the variable(s). If your answer is not an integer, leave it in simplest radical form.

SME 1013 Programming for Engineers

Command-line interface DOS Graphical User interface (GUI) -- Windows

#1 A: Surface Area of Triangular Prisms Calculate the surface area of the following triangular prisms. You must show ALL of your work.

Chapter 11: Measurement of Figures and Solids Part B

Problem Solving and Program Design - Chapter 1. Cory L. Strope

Suggested Pacing. Day 3 8.7B. Rectangular prisms, Triangular Prisms, and Cylinders Day 8 CRM 6 Assessment

MATH STUDENT BOOK. 7th Grade Unit 9

Area rectangles & parallelograms

Chapter Twelve. Systems Design and Development

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

SME1013 PROGRAMMING FOR ENGINEERS

Part 7 - Object Oriented Concepts Classes, Objects, Properties and Methods

Madison County Schools Suggested 4 th Grade Math Pacing Guide

Objective: To learn meaning and concepts of programming. Outcome: By the end of this students should be able to describe the meaning of programming

Introduction. Computers, algorithms

Be able to properly use the following terminology:

Variables in VB. Keeping Track

Introduction to Computers and Java

, 6.7,, Order the numbers from least to greatest. 1. 1, 0, 2, 5, 4. Simplify the expression. 10.

Review for COSC 120 8/31/2017. Review for COSC 120 Computer Systems. Review for COSC 120 Computer Structure

Chapter 1 Introduction to Computers, Programs, and Java

Student Outcomes. Classwork. Opening Exercises 1 2 (5 minutes)

UNIT 3 CIRCLES AND VOLUME Lesson 5: Explaining and Applying Area and Volume Formulas Instruction

11 Data Structures Foundations of Computer Science Cengage Learning

COMP Assignment 1

Discovering Computers 2008

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

Part 1 Arithmetic Operator Precedence

PROBLEM SOLVING AND PYTHON PROGRAMMING

Part (04) Introduction to Programming

Lesson Plan -- Multiplying and Dividing Integers

College Algebra. Quadratic Functions and their Graphs. Dr. Nguyen October 12, Department of Mathematics UK

Algorithms and Flowcharts

Fractions, Decimals, Ratio and Percentages (FDRP) Measures (MEA)

Skills Practice Skills Practice for Lesson 6.1

Programming & Computers

Activity 1: Introduction

SECTION SIX Teaching/ Learning Geometry. General Overview

INFS 214: Introduction to Computing

1) What is the first step of the system development life cycle (SDLC)? A) Design B) Analysis C) Problem and Opportunity Identification D) Development

MATHEMATICS Key Stage 2 Year 6

Fundamentals of Programming. By Budditha Hettige

1 Programming. 1.1 Analyzing a problem

6 th Grade Math Cylinder Task. c) Draw a net (pattern) for the manufacturer to use to make the can.

DRAFT CHAPTER. Surface Area GET READY. xxx. Math Link. 5.1 Warm Up xxx. 5.1 Views of Three-Dimensional Objects xxx. 5.

You will need the following items: scissors, plate, 5 different colored pencils, protractor, paper to answer questions

Computers and FORTRAN Language Fortran 95/2003. Dr. Isaac Gang Tuesday March 1, 2011 Lecture 3 notes. Topics:

Introduction to the C++ Programming Language

Algorithms and Programming Languages

9.55 in. containers have the same surface area as the ball? If not, which container has a surface area that is closer to that of the ball?

Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952. Computing for Biomedical Scientists

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

Part 4 - Procedures and Functions

Introducing Computer Programming

H.O.#2 Fall 2015 Gary Chan. Overview of C++ Programming

Transcription:

I101/B100 Problem Solving with Computers By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend 1

What skill are needed for software development? Problem Solving skills. People skills. Communication Skills. Programming Skills. 2

What is Problem Solving? A mental process. A creative process. Problem solving occurs when one needs to move from a given state to a desired goal state. Ability to think clearly and critically. 3

Some problems? Finding the smallest number in a pile of numbers. Solving a Jigsaw puzzle. Finding the shortest path between two locations. Determining someone s FICO score. Figuring how much paint you need to paint a room. What if the room is the shape of a cylinder or a ball? Figuring out how much grain fits in a silo. Figuring out how much money you will have for college if you save $10 per month for the next 10 years. (c) Copyright 2018, H. Hakimzadeh 4

How do we find the smallest number? Given the following numbers: 7, 88, 23, 12, 49, 14 How does a Human approach this problem? How does a Human using a computer approaches this problem?? (c) Copyright 2018, H. Hakimzadeh 5

Figuring out how much grain fits in a silo. Given a silo with the with 10 feet diameter, 20 feet high, and a dome, how much grain can you fit in it? How does a Human approach this problem? How does a Human using a computer approaches this problem?? (c) Copyright 2007, H. Hakimzadeh 6

Some information you might need! (c) Copyright 2018, H. Hakimzadeh 7

Solution to the problem Once we develop a solution to the problem, we need to tell the computer about it! That requires that we speak in a language that a computer understands. (c) Copyright 2018, H. Hakimzadeh 8

What is Programming: The act of writing a program. To write a program, we need a programming language. We also need an algorithm. (step by step instructions ) 9

What is a Program? A plan to achieve a solution to a problem. A set of sequential instructions, which cause a computer to perform a particular operation or task. 10

Programming Languages: Machine Language (1 st. Generation Languages or 1GL s) Low level languages (2 nd GL s or Assembly Language) High Level Languages (3 rd GL s or languages such as Basic, Java, Pascal, C, C++, COBOL) 11

Machine Language Based on 0's and 1's Instructions are written in 0's and 1's Example: 0110 10001 10100 10110 \ \ \ ADD X Y Z 12

Low level (Assembly) Languages Low level or Assembly Languages provides a one-to-one mapping between symbols (names) and computer instructions and memory locations. Assembly languages are tightly coupled to the machine (processor). Example: ADD X, Y, Z 13

High Level Languages Closer to English Basic, Fortran, C, C++, Java, Cobol, etc. Easier to write and debug programs. Example: Z = X + Y If (Z >= 100) then console.writeline("z is big ) Any high level language must eventually be translated to machine language before the computer can understand it. 14

What is a Compiler? A program that translates a high level language into machine language. Source Code Or Source Program C++, VB,etc. Compiler Object Code Or Object Program 15

Steps in Writing, Compiling and Running a program: Editor Write Program *.vb Compiler Compile the Program *.EXE Run the.exe file 16

Software Development Life Cycle 1) Requirement specification Problem Definition 2) Analysis Input and Output format Requirements (formulas, facts, figures, etc..) Constraints (limits, etc..) Identify possible solutions 3) Design Develop a list of steps (an Algorithm) to solve the problem. An algorithm is often written in a generic language called pseudo-code. Desk check your algorithm. 4) Implementation Convert the algorithm developed in the Design phase into a desired programming language (i.e. VB). 5) Testing Verify the correctness of your program. (component testing, and overall testing.) 6) Maintenance Add, modify, and maintain the system. 17

Problem Solving Techniques 1) Ask questions to fully understand the problem What is my data? (what does it look like?, How much data is there?) How will I know when I have processed all the data? What should the output look like? How many times is the process going to be repeated? What special error conditions might arise? 2) Identify patterns Reuse previous solutions, do not reinvent the wheel 3) Solve by analogy Think of similar problems and how you solved them. 4) Means end analysis Given a set of input data, how do we reach the desired output results, provided a set of tools at our disposal. 5) Divide and conquer Divide the problem into a series of smaller, more manageable problems. 6) Merging Solution Some problems can be viewed as a combination of 2 or more existing problems. (merge the existing solutions to get the new solution!) 7) Start by starting Start by rewriting the problem in your own words. Try explaining the problem to your friend. 8) Algorithmic Problem Solving Develop a step by step solution to a problem and then refine it. (step wise refinement) 18

Sample Problems? 1. Compute and display the Area and the Circumference of the circle. 2. Calculating Student Grades 3. Find the Smallest and Largest Integer Value entered by the User 19

Problem 1: Given the radius of a circle, compute and display the Area and the Circumference of the circle. R 20

Problem 1: Given the radius of a circle, compute and display the Area and the Circumference. Analysis: Determine the Input and Output of the program Determine the formulas, fact, etc. needed Design: Develop a list of steps to solve the problem (An algorithm) 21

Problem 1: Given the radius of a circle, compute and display the Area and the Circumference. Analysis: Determine the Input and Output of the program: - Radius of a circle Determine the formulas, fact, etc. needed: Design: - Area = PI * (Radius) 2 - Circumference = 2 * PI * Radius - PI = 3.14159 - Develop a list of steps to solve the problem (An algorithm) 1) read the radius 2) compute the Area 2.1) Area = PI * (Radius)2 3) computer the circumference 3.1) Circumference = 2 * PI * Radius 4) print the area and circumference 22

Problem 1: Given the radius of a circle, compute and display the Area and the Circumference. Implementation: Module Module1 Sub Main() Dim radius, area, circumference As Double Const PI = 3.14159 Console.Write("Please enter the radius of the circle? ") radius = Console.ReadLine() area = PI * radius * radius circumference = 2 * PI * radius Console.WriteLine("Area = " & area) Console.WriteLine("Circumference = " & circumference) Console.ReadLine() 'just to pause the program. End Sub End Module 23

Problem 2: Calculating Student Grades 24

Problem 2: Calculating Student Grades Write a program which accepts a student name and test score as input. The program then determines the letter grade for the student and produces an output similar to the following: Name Score Letter Grade Mary 93 A The Letter Grades are calculated as follows: >=90 A >=80 B >=70 C >=60 D < 59 F The test score is between 1 and 100. 25

Problem 2: Calculating Student Grades Problem Definition: Do you understand the problem? If so write it in your own words Analysis: Determine the Input and Output of the program Determine the formulas, fact, etc. Design: Develop a list of steps to solve the problem (An Algorithm) Implementation: Convert your design into VB code 26

Problem 2: Calculating Student Grades Design: 1) read the student name and test_score 2) Determine the letter grade if testscore >=90 and testscore <= 100 letter grade = A if testscore >=80 and testscore < 90 letter grade = B if testscore >=70 and testscore < 80 letter grade = C if testscore >=60 and testscore < 70 letter grade = D if testscore < 60 letter grade = F 3) Display the name, test score and letter grade 27

Problem 2: Calculating Student Grades Convert your design into code Module Module1 Sub Main() Dim name As String Dim test_score As Double Dim letter_grade As String Console.Write("Please enter the student name? ") name = Console.ReadLine() Console.Write("Please enter the student test score? ") test_score = Console.ReadLine() If (test_score >= 90) And (test_score <= 100) Then letter_grade = "A" End If If (test_score >= 80) And (test_score < 90) Then letter_grade = "B" End If If (test_score >= 70) And (test_score < 80) Then letter_grade = "C" End If If (test_score >= 60) And (test_score < 70) Then letter_grade = "D" End If If (test_score < 60) Then letter_grade = "F" End If Console.WriteLine("Name Score Letter Grade") Console.WriteLine("{0} {1} {2}", name, test_score, letter_grade) Console.ReadLine() 'just to pause the program. End Sub End Module 28

Problem 3: Finding the Smallest Integer Value entered by the User 29

Problem 3: Find the Smallest Integer value entered by the user Problem Definition: Do you understand the problem? if so write it in your own words Analysis: Determine the Input and Output of the program Determine the formulas, fact, etc. Design: Develop a list of steps to solve the problem (An Algorithm) 30

Problem 3: Find the Smallest Integer value entered by the user Problem Definition: The user is asked to enter a few positive numbers. If the user enters a zero, the program should stop. After the program stops, it should display the Smallest number entered by the user. Analysis: Input should be integer numbers >= 0. Each new number should be compared with the old Smallest number, to see if a new Smallest has been found. Design: Get a number from the user. Set the Smallest to the above number Start a loop which only stops when the user enters a zero. Inside the loop get a new number from the user. Check to see if the number is smaller than the smallest. If so, replace the smallest with the new number. 31

Convert your Design into Pseudocode Number = Read from keyboard Smallest = Number loop until Number = 0 if Number < Smallest then Smallest = Number. Number = Read from keyboard End Loop Display the Smallest 32

Convert your Pseudocode into Code Option Strict On Option Explicit On Module Module1 Sub Main() Dim Smallest, Number As Integer Console.WriteLine("Enter a series of positive integers. (0=stop)") Number = CInt(Console.ReadLine()) Smallest = Number Do Until Number = 0 If Number < Smallest Then Smallest = Number End If Number = CInt(Console.ReadLine()) Loop Console.Write("The smallest was : ") Console.WriteLine(Smallest) End Sub End Module 33