AP Computer Science Principles 2020 Pilot Create Task Student Sample E CSP 2020 Sample E AP Computer Science Principles 2020 Create Task Student Sample E 3a My program ultimately works to address the[.]
Trang 1AP Computer Science Principles: 2020 Create Task
Student Sample E
3a My program ultimately works to address the issue of screen addiction in society, as users who record their usage are more conscious of their own addiction My program then tackles the issue head
on, as new alternatives to screen usage can be selected with the activities button, mitigating overall
screen usage As can be seen from the illustration of my program, users are able to input the amount
of time they spend on their screen each day This data is collected and can be paused by the users,
and resumed at whatever time they continue use of their screen Then once the user feels that have
used a sufficient amount of screen time in a day, they can click the screen free challenge button to output an amount of time to go screen free They also have the activity button which outputs
different activities to try that don’t involve screens
3b
The list “activity” shown here is essential to my program because it contains the data that represents
alternatives to screen usage and screen free challenge times This list of data is essential to reducing
screen addiction, and manage the overall complexity of my code Instead of having several different buttons display alternative activities, the lists allow me to store all the data in one organized location A procedure is then able to randomly select one of the strings for an index, to ensure that each string is displayed an
approximately equal number of times Without this list and another list that provides time amounts for the
activities managing the complexity of the code, I would’ve had to individually enter each string into a
separate button, creating redundancy in my code I also would not have been able to ensure that each
string was picked equally, because the individual buttons would not be controlled by the same procedure
Trang 23c Procedure: procedurerunclock
Call to Procedure procedurerunclock
The procedure, procedurerunclock, contributes to the overall functionality of my program, as it allows the
stopwatch to both run and display the changing time every millisecond The procedures, working in
accordance, use the time parameter to make sure that the time is recorded by the stopwatch, and is then
displayed live, when the user clicks the start button Without the stopwatch it would not be possible for
user to record the amount of time they spend on their screen, which is a crucial function to my app If
users are unable to see how much time they spend on their screens then they will not be conscious of
their addictions, and therefore not willing or likely to take screen free challenges and try alternative
activities The algorithm accomplishes this task as it utilizes the parameter “time” to get the new time as
the clock runs, and then updates this time so that it is displayed in a label The parameter for time is
essential to my algorithm, as procedure run clock would not work without it, and thus procedure display
clock could not update either
3d
In the two test cases for my procedure the app user spent 30 minutes on their screen both times, before deciding
to take a screen free challenge and try an alternative activity In the first test, the user was directed to take a 60 minute screen free challenge, and try doing their homework instead In the second test case, the user was directed to take a 120 minute screen free challenge and try visiting their friends instead In my app the string data was programmed into the code, and each string was selected randomly, meaning that there was no expected
Trang 3result for either of the test cases The conditions being tested are which string will be randomly selected Once the program selects a string it then joins “Go Screen Free For:” with an amount of time, or “Try this activity:” is joined with an activity The procedure to do this task accomplishes this goal by selecting a random fraction between 0 and 1, and then each of the six strings corresponds with a fraction The corresponding string closest
to the fraction chosen is then selected and displayed in the label