Problem : At Kiddy School, the teachers used the A, B,C for grading the students’ works. If the student get an A, then the teacher will print “Excellent”

Slides:



Advertisements
Similar presentations
PROBLEM SOLVING TECHNIQUES
Advertisements

Al-Karma Language School Computer Department Prep. 3.
Algorithms CSC1310 Fall What Is Programming? Programming Programming means writing down a series of instructions that tell a computer what to do.
Introduction to Computing Science and Programming I
Subject: Information Technology Grade: 10
Chapter 2 - Problem Solving
 2002 Prentice Hall. All rights reserved Control Structures 3 control structures –Sequential structure Built into Python –Selection structure The.
Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart.
7. C program structure.
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1 Pseudocode & Flowcharts
Line Continuation, Output Formatting, and Decision Structures CS303E: Elements of Computers and Programming.
Looping While-continue.
Python File Handling. In all the programs you have made so far when program is closed all the data is lost, but what if you want to keep the data to use.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Type accurately challenge! This is a starter activity and should take 2 minutes [ slide 1 ] 1.Can you type out the code in Code Box 2.1 with no errors.
EXERCISE IN CLASS CHAPTER 2. PART 1 SEQUENCE SCENARIO 1 Write an algorithm for a C program, that prompts user to enter total number of umbrellas he/she.
PROBLEM SOLVING & ALGORITHMS CHAPTER 5: CONTROL STRUCTURES - SELECTION.
Control Structures II Repetition (Loops). Why Is Repetition Needed? How can you solve the following problem: What is the sum of all the numbers from 1.
CSEB 134 Assignment 1 Problem Solving. Instructions  This is a group assignment on Problem Solving  Each group consist 2 or 3 students.  Each group.
Writing JavaScript Functions. Goals By the end of this unit, you should understand … How to breakdown applications into individual, re-usable modules.
Program Planning and Design. What is Program Planning and Design? Program planning and design is simply knowing what you want to do and how you want to.
Continue with conditional
TK 1914 : C++ Programming Control Structures I (Selection)
CS 100 Introduction to Computing Seminar
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
22/11/ Selection If selection construct.
Decision Structures, String Comparison, Nested Structures
Validation final steps Stopping gaps being entered in an input.
Sensitivity Analysis A systematic way of asking “what-if” scenario questions in order to understand what outcomes could possibly occur that would effect.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
Concepts of Algorithms CSC-244 Unit Zero Pseudo code, Flowchart and Algorithm Master Prince Computer College Qassim University K.S.A.
If statement.  It is made up of three main components:  The keyword itself,  an expression that is tested for its truth value,  and a code suite to.
Pseudocode Skill Area Materials Prepared by Dhimas Ruswanto, BMm.
Introduction to Programming Python Lab 7: if Statement 19 February PythonLab7 lecture slides.ppt Ping Brennan
1 VB-04-Control Structures 16 March 2016 Visual Basic Control Structures - Selection.
CIS 115 All Exercises Devry University (Devry) For more course tutorials visit CIS 115 All Exercises Devry University.
CIS 115 All Exercises Devry University (Devry) FOR MORE CLASSES VISIT CIS 115 All Exercises Devry University.
Repetition statements
CIS 115 Slingshot Academy / cis115.com
Starter What does the following code do?
Lesson Objectives Aims To be able to write an algorithm in Pseudo Code
3.1 Fundamentals of algorithms
Line Continuation, Output Formatting, and Decision Structures
Introduction to Programming
Lecture 2 Introduction to Programming
CS 108 Computing Fundamental Notes for Thursday, October 5, 2017
For Monday Read WebCT quiz 18.
Line Continuation, Output Formatting, and Decision Structures
Introduction to Programming
ALGORITHM BASICS- Part 3
Decision Structures, String Comparison, Nested Structures
Programming Fundamentals (750113) Ch1. Problem Solving
1) C program development 2) Selection structure
If selection construct
For Wednesday No new reading No quiz.
Introduction to Programming
If selection construct
Class Examples.
Programming Fundamentals (750113) Ch1. Problem Solving
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Flowcharts and Pseudo Code
Python Basics with Jupyter Notebook
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Programming
Continue with conditional
WJEC GCSE Computer Science
Challenge Guide Grade Code Type Slides
Presentation transcript:

Problem : At Kiddy School, the teachers used the A, B,C for grading the students’ works. If the student get an A, then the teacher will print “Excellent” and if the student get B, the teacher will print “Good”. For students that get C, the teacher will print “Work Harder”. Given the problem above, design a solution using flowchart.

Solution Y n Y n

>>> grade=raw_input('enter student grade') enter student gradeA >>> if grade =='A':... print "Excellent"... elif grade =='B':... print "Good"... else:... print "Work Harder"... Excellent Input is string therefore use raw_input function User input A String –characters is compared lexicographically order, hence must put capital letter result

>>> grade =raw_input('enter student grade ') enter student grade a >>> if grade=='A' or grade =='a':... print 'excellent'... elif grade =='B' or grade =='b':... print 'good'... else:... print 'work harder'... excellent ‘a’ and ‘A’ have two different values. To handle input either in capital letter or small letter, the condition is joining with ‘or’ operator

 Problem: Your instructor asked you to design a program that can receive two input number (assumed that both number are not the same) and determine the larger of the two. Design a flowchart the problem above.

>>> a=input('input the first integer') input the first integer2 >>> b= input('input the second integer') input the second integer3 >>> if a > b:... print a... else:... print b... 3 Input by user Make sure the proper indentation is used Result after comparison

Problem: Your instructor asked you to design a program that can take 3 input and determine the largest of three input integers. Draw flowchart and write Python code for the problem above.

>>> a=input(' enter the first number :') enter the first number :2 >>> b=input(' enter the second number :') enter the second number :3 >>> c=input ('enter the third number :') enter the third number :1 >>> if a > b:... if a> c:... print a... else:... print c... elif b > c:... print b... else:... print c... 3

 Using the text given, draw a flowchart for mailing a letter: _html/ch02.htm Start Stop Address the envelope Put letter in the envelope Put the envelope in the mail box Put the local stamp on Put the airmail stamp on Is it airmail? Seal the envelope Go to the mail box

 Given the following text, construct a flowchart for changing a flat tire on a car. _html/ch02.htm Put the spare tire start Put Jack & flat in the trunk stop Jack up rear of car Remove the flat tire Jack up the front of car Lower the car Remove the spare from the trunk Remove the jack from the trunk Is flat a front tire?

 Draw a flowchart for a Patient Intake Process in the clinic. Use all the texts presented below. Patient in the system? Patient arrives at Front Desk Ask patient to be seated in the waiting room Patient fill up the new patient form Nurse ask for patient’s name and search the database Patient go to exam room Patient leave the clinic HIVQUAL Group Learning Guide

solution

 The table below shows the normal boiling points of several substances. Design a program that prompts a user for the observed boiling point of a substance in degree Celsius ( C 0 ) and identifies the substances if the observed boiling point is within 5% of the expected boiling point. If the data input is more than 5% higher or lower than any of the boiling points in the table, the program should output the message Substance unknown

SubstanceNormal boiling point (Celsius) Water100 Mercury357 Copper1187 Silver2193 Gold2660 In your design : 1.Identify the input 2.The desired output 3.Write the algorithm and pseudo code

 Input –the observed boiling point of a substance in degree Celsius ( C 0 )  Output- identifies the substances if the observed boiling point is within 5% of the expected boiling point  Algorithm

Input the boiling point if the boiling point is between 95 to 100 then the substance is water else if the boiling point is between 337 to 357 the substance is mercury else if the boiling point is between 1128 to 1187 the substance is copper else if the boiling point is between 2083to 2193 the substance is silver else if the boiling point is between 2527 to 2650 the substance is gold else if the boiling point is more than 2650 and lower than 95 the substance is unknown.

 Keith’s Sheet Music needs a program to implement its music teacher’s discount policy. The program is to prompt the user to enter the purchase total to indicate whether the purchaser is a teacher. Music teachers receive a 10% discount on their sheet music purchases unless the purchase total is RM100 or higher. In that case, the discount is 12%. The discount calculation occurs before addition of the 5% sales tax. The sample outputs are as below: two output, 1 for teacher another one is not teacher.

Total purchases RM Teacher’s discount RM Discounted total RM Sales tax RM 5.37 Total RM Total purchases RM Sales tax RM 1.25 Total RM What you need to do? 1.Analyze the problem - Identify input -Identify output -Identify formula 2. Write a pseudo code 3.Draw a flowchart 4. Write a Python code

 Discuss in class