Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Problem 6 IPO Chart Algorithm Flowchart Trace Table Pascal Program

The document describes a program that takes a user's age as input and outputs whether they are old enough to drive based on being 17 years of age or older. It includes the problem statement, IPO chart, pseudocode, flowchart, sample trace tables and a program written in Pascal.

Uploaded by

Rayad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Problem 6 IPO Chart Algorithm Flowchart Trace Table Pascal Program

The document describes a program that takes a user's age as input and outputs whether they are old enough to drive based on being 17 years of age or older. It includes the problem statement, IPO chart, pseudocode, flowchart, sample trace tables and a program written in Pascal.

Uploaded by

Rayad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Rayad S.

Ali
4.2 IT

Problem #6
Write a program that could tell a user whether they are old enough to
learn how to drive a car. If the user's age meets the required driving
age which is 17 years old the program would print the Message You
are old enough to drive a car. Otherwise, it would print the Message
You are not old enough to drive a car.

I.P.O Chart

Input Processing Output


User’s age (1). Read user’s age Message either

(2). Determine if the You are old enough


person is old enough to to drive a car
drive a car OR
You are not old
(3). Print appropriate enough to drive a car
message, either
You are old enough to
drive a car or not old
enough to drive a car.

Pseudocode Algorithm

Algorithm Person is old enough to drive


This algorithm reads a person’s age. If the person is 17 or over it will
print “You are old enough to drive a car ”. If the person is under 17
years of age, it will print “You are not old enough to drive a car”.

Variable Name Variable Data Type Variable Description


UserAge Integer Stores the user’s age
Rayad S. Ali
4.2 IT

START
Read UserAge
If UserAge >= 17 then
Print ‘You are old enough to drive a car’
Else
Print ‘You are not old enough to drive a car’
End if
STOP
Rayad S. Ali
4.2 IT

Flowchart

START

Read UserAge

UserAge
>= 17

Print ‘You are old Print ‘You are not old


enough to drive a car’ enough to drive a car’

STOP
Rayad S. Ali
4.2 IT

Trace Table

Test Data Set #1


UserAge= 35

Instructions in execution UserAge Output


START
Read UserAge 35
If UserAge >= 17 then
Print ‘You are old enough to You are old enough to
drive a car’ drive a car
End if
STOP
Rayad S. Ali
4.2 IT

Trace Table

Test Data Set #2


UserAge= 14

Instructions in execution UserAge Output


START
Read UserAge 14
If UserAge >= 17 then
Else
Print ‘You are not old enough You are not old enough
to drive a car’ to drive a car
End if
STOP
Rayad S. Ali
4.2 IT

Pascal Program
Program Age_to_learn_how_to_Drive; // This is the Program Header //
//This program reads a person’s age. If the person is 17 or over it will
print “You are old enough to drive a car ”. If the person is under 17
years of age, it will print “You are not old enough to drive a car”.//

Var // This is the Variable Declaration //


UserAge:Integer;

BEGIN // The body of the program starts here //


Writeln (‘Please enter your age’);
Readln (UserAge);
IF UserAge >= 17 THEN
BEGIN
Writeln (‘You are old enough to drive a car’);
END
ELSE
BEGIN
Writeln (‘You are not old enough to drive a car’);
END;
Readln;
END. // The body of the program ends here //

You might also like