Computer science

Computer science

Scientists monitor the advance signs of mudslides by embedding motion
detection sensors in the ground. Increasingly large ground movement levels
may indicate that a mudslide is imminent.
You are going to create part of a prototype for a computer program to
monitor ground movement levels in a mudslide zone. The position of the
slider will represent the level of the current ground movement: so a large
slider value will correspond to a large ground movement and a small slider
value will correspond to a small ground movement. Each reading of the
ground movement level (slider value) will be compared with the previous: if
it is the same, a circle will be displayed on the Stage; if it is smaller, a
downward-pointing arrow will be displayed on the Stage; if it is bigger, an
upward-pointing arrow will be displayed on the Stage. Each reading along
with the number of readings taken so far will be written to a text file for
later analysis.
In parts (a) and (b) of this question you will complete a single script. The
script in part (c) will control the execution of the preceding scripts by
sending appropriate broadcast messages. You do not need to consider how
the scripts will interact until you come to part (c). (The scripts for parts (a)
and (c) have been partially created for you.)
With your SenseBoard connected, open the Sense file TU100_TMA05_Q3.
sb which is available from the Supporting files area of the ‘Assessment
resources’ page on the TU100 website. Make sure that the SenseBoard is
detected (select show SenseBoard watcher from the Extras menu).
Notice that we have created three variables which you will use:
. currentMovementLevel to hold the reading of the current movement
level (the current slider value)
. previousMovementLevel to hold the reading of the previous
movement level (the previous slider value)
. readingNumber to hold the number of readings of movement levels
(slider values) obtained so far.
In this part, you will investigate and complete the Stage script headed with
the hat block when_I_receive[setDisplay] which is responsible for the
Stage display. To do this, it will broadcast messages which are responded to
by the sprites DownArrow, UpArrow and Circle. Inspect these sprites and
their scripts.
(i) The partially-complete script headed when_I_receive[setDisplay]
currently sends three messages, responded to by scripts belonging to
DownArrow, UpArrow and Circle. What do these scripts do?
(ii) Now complete the script headed when_I_receive[setDisplay] by
adding blocks underneath the existing ones so that it achieves the
following:
7
◦ if the current and previous movement levels are the same, the
circle is shown on the Stage
◦ if the current movement level is less than the previous
movement level, the downward-pointing arrow is shown on the
Stage
◦ if the current movement level is greater than the previous
movement level, the upward-pointing arrow is shown on the
Stage.
You should use the variables previousMovementLevel and
currentMovementLevel and assume that when your script is run as
part of the overall program their values will already have been set to the
readings of the previous and current movement levels (slider values)
respectively.

READ ALSO :   Supply Chain Management - Baldrige assignment:

Place this order with us and get 18% discount now! to earn your discount enter this code: special18 If you need assistance chat with us now by clicking the live chat button.