A survey is being carried out which involves reading and recording sound levels near a busy road
junction. Once all the data are collected, they are input manually into a computer. A sound level
of 0 decibels (0 dB) is input to indicate the end of the data.
Write an algorithm, using pseudocode or a flowchart, which:
• inputs all the sound levels
• after a sound level of 0 is input, outputs the following:
o average sound level
o highest recorded sound level.
SoundLevel=input(SoundLevelsList)
SoundLevelAvg=average(SoundLevel)
SoundLevelMax=max(SoundLevel)
if SoundLevel=0
print("The average sound level is ", SoundLevelAvg, " db. The highest recorded sound level is ", SoundLevelMax)
Comments
Leave a comment