CPT
CPT
CPT OUTLINE
The fullstack comments section is a web application designed to allow users to leave comments on a webpage. The programâs overall purpose is to provide an interactive platform for website visitors to share their thoughts and opinions.
The functionality demonstrated in the video includes adding a comment to the webpage, viewing previously posted comments, and deleting comments. The input for the program demonstrated in the video includes text input by the user when creating a new comment, while the output includes the display of comments on the webpage.
One of the ways the program manages complexity is through the use of lists. In one program code segment, data is stored in a list by appending new comments to the end of the list. The second program code segment shows how the existing data in the list is used, such as accessing multiple elements in the list to display previously posted comments.
The name of the list used in the program is âcommentsâ. The data contained in the list represent individual comments posted by users on the webpage. The selected list manages complexity in the program by providing a way to store and access a potentially large number of comments without the need for multiple variables.
The student-developed procedure in one of the program code segments is called âinsert_commentâ. This procedure takes in parameters such as the comment text, the commenterâs name, and the commentâs date and time. The procedure then appends the new comment to the âcommentsâ list, effectively adding it to the webpage. The algorithm implemented in the âinsert_commentâ procedure involves sequencing, selection, and iteration. The procedure first checks that the comment text is not empty, then checks that the commenterâs name is not empty, and finally adds the comment to the âcommentsâ list.
The âinsert_commentâ procedure contributes to the overall functionality of the program by allowing users to add new comments to the webpage. When called, the procedure checks that the comment and name fields are not empty and adds the new comment to the âcommentsâ list. The algorithm implemented in the âinsert_commentâ procedure works by first checking if the comment and name fields are not empty. If they are not empty, the procedure creates a new comment object with the input data and appends it to the âcommentsâ list.
In written response 3d, two calls to the âinsert_commentâ procedure are described. In the first call, the comment text field is left blank while a name and date/time are provided. The condition tested by this call is whether the comment text field is empty or not. The result of this call is that the comment is not added to the âcommentsâ list. In the second call, both the comment text and name fields are provided while the date/time field is left blank. The condition tested by this call is whether the date/time field is empty or not. The result of this call is that the comment is added to the âcommentsâ list. Overall, the fullstack comments section meets the College Boardâs requirements for APCSP by providing a functional web application that uses programming concepts such as lists and procedures to manage complexity and achieve its purpose.
CPT OUTLINE