ict flowchart and pseudo codes

10
ICT ASSIGNMENT Flow Charts and Pseudo Codes with Python

Upload: happy-nezza-bolongaita

Post on 13-Feb-2017

264 views

Category:

Education


6 download

TRANSCRIPT

Page 1: ICT Flowchart and Pseudo codes

ICT ASSIGNMENTFlow Charts and

Pseudo Codes with Python

Happy Nezza B. Aranjuez9 – Becquerel

1. A flowershop sells roses for Php 25 each and tulips for Php 40 each. Prepare a flowchart, pseudocode, and python code that determines how much Irene will spend if she will buy R number of rose and T number of tulips.

Page 2: ICT Flowchart and Pseudo codes

FLOWCHART:

PSEUDOCODE:TT = T x PRRR = R x PTTotal = TT + RRoutput irene will spend, Total pesos

PYTHON CODE:

2. Print your average grade if it is greater than 85.

FLOWCHART:

START Input T Input R

PT x T PR x T

(PT x T) + (PR x T)

Irene will spend total

pesosEND

Page 3: ICT Flowchart and Pseudo codes

PSEUDOCODE:grade = input what is your gradeif grade > 85 then output you passed your grade is, gradeelse output that’s alright

PYTHON CODE:

3. Accept and print positive numbers only.

FLOWCHART:

START Input grade

If grade > 85

Input gradeInput grade

Output you passed your grade is, grade

END

Output that’s alright

TRUE FALSE

Page 4: ICT Flowchart and Pseudo codes

PSEUDOCODE:

number = input "Input a number:"while True: if number > 0: output the number of your choice is, number

break else:

output invalid number number = input “Input a number”

PYTHON CODE:

4. Input 3 numbers a, b, and c,a. If a is equal to b, print cb. If a is greater than b, then print their differencec. If b is less than c, then print their sum, otherwise print their average

START Input number

If number is positive

Output invalid number

Output number

TRUE FALSE

END

A

A

Page 5: ICT Flowchart and Pseudo codes

FLOWCHART:

PSEUDOCODE:a = input "Input a number:"b = input "Input a number:"c = input "Input a number:"while True: if a == b: output c if b < c: output b+c break else: output (b+c)/2 break elif a > b: output a-b

PYTHON CODE:5. Print passed if the user specified grade is at least 75, if otherwise print

failed.

START Input a

If a = b

Output cOutput average

TRUE

FALSE

END A

A

Input c Input c

If a > b

If b < c

Average =

(b+c)/2

FALSE FALSE

Sum = b + c

Dif = a - b

TRUETRUE

Output sum

Output dif

A

Page 6: ICT Flowchart and Pseudo codes

FLOWCHART:

PSEUDOCODE:

grade = input "What is your grade?"if grade >= 75: output passedelse: output failed

PYTHON CODE:

START Input grade

If grade >= 75

Output FailedOutput Passed

TRUE FALSE

END

Page 7: ICT Flowchart and Pseudo codes

6. Convert the user’s weight from pounds to kilograms if the inputted value is positive. Otherwise, print invalid data. (1kg = 2.2 lbs)

FLOWCHART:

PSEUDOCODE:weight = input "How many pounds do you weigh?" if weight > 0: convert = weight/2.2 output convertelse: output invalid data

PYTHON CODE:

START Input weight

If number is positive

Output invalid number

Output convert

TRUE FALSE

Convert =Weight/2.2

END

Page 8: ICT Flowchart and Pseudo codes

7. Compute for the equivalent percentage grade of the given score using the format score/100*60+40. Print a corresponding remark based on the following guidelines:

90-100 excellent 85-89 very good 80-84 good 75-79 fair 74 below – needs improvement

FLOWCHART:

PSEUDOCODE: PYTHON CODE:score = input "What is your score?" grade =score/100*60+40if 100>=grade>= 90: output excellentelif 89>=grade>= 85: output very goodelif 84>=grade>= 80: output goodelif 79>=grade>= 75: output fair

Page 9: ICT Flowchart and Pseudo codes

else: output needs improvement