Uploaded by Mrisho Madua

PROGRAMMING ASSIGMENT 2[1]

advertisement
THE INSTITUTE OF FINANCE MANAGEMENT
FACULTY OF COMPUTING, INFORMATION SYSTEM & MATH
DEPARTMENT OF INFORMATION TECHNOLOGY
BACHELOR DEGREE IN INFORMATION TECHNOLOGY
YEAR ONE
ACADEMIC YEAR: 2022/2023
GROUP ASSIGNMENT
S/N
NAME
REGISTRATION NUMBER
1
JAFARI KHALIFA KIWANGA
IMC/BIT/2221568
2
MUDATHIR RAJAB ABDALLAH
IMC/BIT/2221460
3
GIDEON G. NDIMBO
IMC/BIT/2221621
4
SIGFRID SIMON NGONYANI
IMC/BIT/2221599
5
KENEDY RICHARD SINKONDE
IMC/BIT/2225355
The problem is to calculate the speed of the car moved per time and been printed in the car dash
board by a speed meter.
Data given: Time “T”
Distance moved by a car “D”, Gear “G”
So: Speed=Distance/Time
1.The problem analysis chart
PAC
1: Data Given
2: Required Result
Time
Distance
Gear
Speed
3: Required Result
4 :Alternative Solution
Speed=Distance/Time
1: Distance moved and Time as a constant
2: Distance moved and Time as input values
Interactivity chart for calculating speed
Speed Control
Read (Time, Distance,
Gear)
Calculate
Print
Speed
Speed
Input Proccessing Output (IPO)
Inputs
Processing
Module Reference
Outputs
Time Taken
Distance Covered
Gear
1.Enter Distance
Covered
2.Enter Time Taken
3.Enter Gear Number
4.Calculate Speed
Print Speed
5.End
Read
Read
Read
Print
Speed Control
Speed
The coupling diagram and data dictionary
The coupling diagram
Time
Control Speed
Distance
Time
Read
Distance
Time
Speed
Distance Speed
Time
Distance Speed
Calculate
Speed
Print
The data dictionary
Item
Variable
Name
Data Type
Module
Scope
Pseudonym/Module Error
Check
Distance
Distance
Control
Speed
Read/Calc
Local
Distance
None
Distance
Distance
Numericreal
Numericreal
Parameter
Distance
Time < 0
Time
Numericreal
Control
Speed
Local
Time
None
Time
Time
Numericreal
Read/Calc
Parameter
Time
Distance
<0
Net
Speed
Speed
Numericreal
Control
Speed
Local
None
None
Net
Speed
Speed
Numericreal
Read/Calc
Parameter
None
None
Time
Algorithm for the problem
1.Enter time, distance and gear number.
2.Calulate the speed
3.IF G=1 THEN print speed 40km/hr
4.IF G=2 THEN print speed 60km/hr
5.IF G=3 THEN Print speed 120km/hr
6.IF G=4 THEN print speed 180km/hr
7.EXIT
Start
Flow Cart
Read Time,
Distance,
Gear
S=D/T
Case Of
G=1
G=2
G=3
G=4
Print
Print
Print
Print
40km/hr
60km/hr
120km/hr
180km/hr
Exit
Pseudocode for calculating the Speed
Enter time, gear and distance
Calculate speed in km/hr
If G=1 Print 40km/hr
If G=2 Print 60km/hr
If G=3 Print 120km/hr
If G=4 Print 180km/hr
Exit
Download