0% found this document useful (0 votes)
2 views9 pages

Basleal.liabrary

The project involves designing and building a library of functions on any chosen topic, requiring at least two functions with specific features such as loops and if-statements. Students will brainstorm, design, build, test, and share their libraries, receiving feedback for improvement. The project emphasizes collaboration, documentation, and the ability to create useful programming tools.

Uploaded by

baslealtamiru16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views9 pages

Basleal.liabrary

The project involves designing and building a library of functions on any chosen topic, requiring at least two functions with specific features such as loops and if-statements. Students will brainstorm, design, build, test, and share their libraries, receiving feedback for improvement. The project emphasizes collaboration, documentation, and the ability to create useful programming tools.

Uploaded by

baslealtamiru16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Name(s)_______________________________________________ Period ______ Date ___________________

Project - Make a Library

Project Description
Libraries let you build functions that you and others can use to help build more powerful apps in lots of situations. As
the designer of a library you not only need to know how to program, you also need to think about the many different
kinds of programs other people might build.

For this project you will design and build a library of functions around any topic you want. You will have an opportunity
to exchange feedback with another group about how you might use their library to design an app. Finally you will
answer a few questions about the library you designed.

You will submit


●​ A link to your library of functions
●​ This completed project guide

Library Requirements
●​ Your library must contain two or more functions
●​ At least one function must include
○​ A loop
○​ An if-statement
○​ One or more parameters
○​ Return

Step 1 - Brainstorm
Your library can be about any topic. If you need some ideas try the list below

●​ Strings
○​ Capitalize: Capitalize first letter of each word in a sentence (long string)
○​ Trim: Remove spaces from beginning and end of a string
○​ Remove Letter: removes a given letter from a string
○​ Anything else you'd want to do with a string​

●​ Lists
○​ Maximum: Find the maximum value in a list
○​ Minimum: Find the minimum value in a list
○​ Average: Find the average value in a list
○​ Count: Count how many times a given value appears in a list
○​ Combine: Join two lists together in one longer, larger list
○​ Filter Numbers: Keep numbers in a list greater than or less than a provided value
○​ Filter Letters: Keep strings in a list that begin with a given letter
○​ Numbered List: Turn a list into a string with each item numbered and appearing on a different line
○​ Top 3: Return the three biggest numbers in a list, in sorted order (This can be a little tricky)
○​ Unique: Return a list of each unique item that appears in (This can be a little tricky)
○​ Sort: Return the list in sorted order (This can be a little tricky)
○​ Anything else you'd want to do with a list ​

●​ Dataset
○​ Choose a dataset and build a function that will help a user access or summarize specific information
within that dataset

●​ Something else
○​ As long as your library does something interesting and valuable

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 1


Step 2 - Design
After you've brainstormed the focus of your library, fill in the table below with the list of functions you intend to build.

Function Name Description, Parameters, Return Loop, If-statement, Param, Return?


Write the name of Write the comments for this function At least one function must include all 4
each function features listed above

maximum(list) // Takes a list and returns the largest value Yes this function should include all of
that appears in the list these features.
// list {list} - the list of items
// return {number} - the largest number in
the list

Step 3 - Build
Program your library. Make sure you do the following.

●​ Start by building the function that will include all four required features (param, return, if-statement, loop)
●​ Debug your code as you write it
●​ Start testing your code early with sample inputs

Step 4 - Test
Write test cases for each of the functions in your library to make sure they return the expected values. Remember that
you should include.

●​ Inputs (arguments) that will result in your functions behaving differently or returning different values
●​ Inputs (arguments) just before, at, and after cut offs if your conditionals. For example if your code includes the
statement (value < 2) then try inputs where value is 1, 2, and 3 to see if the algorithm always behaves as you
expect.

Note: Once you are done testing your functions, make sure to comment out any tests you have written into your code
to test your library functions before sending your library to a classmate in Step 5.

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 2


Step 5 - Share and Feedback
Send your library to a classmate and have them send it to you. You shouldn't need to explain anything about how your
library works or what it is for. The documentation should be good enough.

Your reviewer should fill in the information below.

Reviewer Name: _________________________________________________

Yes Kind Of No

Clear: I can easily understand the overall purpose of


the library and each function within it.

Error-Free: Each function in the library works as


expected.

Useful: I can think of situations where I would want


to use this library

I like: Give feedback on at least one thing you like in the library

I wish: Give one problem or limitation of the library

What if: Give one idea for how to improve the library

Step 6 - Improve
Based on the feedback above make final improvements to your library.

Step 7 - Acknowledge Collaborators / Sources


It is important to acknowledge any code you write that was developed collaboratively or that you received from another
source. In the table below list work you completed with a collaborative partner or got from another source

Name / Source Lines of Code / Portions of Program Contributed

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 3


Step 8 - Free Response - Practice Personalized Project Reference Sheet

Procedure: Capture and paste two program code segments you developed during this project that contain a
student-developed function that implements an algorithm used in your program and a call to that function.

I.​ Copy and paste a function definition from your library that:
a.​ Defines the procedure’s name and return type (if necessary)
b.​ Contains and uses one or more parameters that have an effect on the functionality of the procedure
c.​ Implements an algorithm that includes sequencing, selection, and iteration

Paste the code of your procedure here

II.​ Copy and paste an example call to the function definition above.

Paste the call to your procedure here

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 4


Step 9 - Free Response - Create Performance Task Writing Practice

1.​ Refer to a code segment from your project that performs a specific task.
(a) Write documentation that describes the purpose of this code segment. Your documentation should explain
what the code does, its inputs, and its expected outputs.
(b) Explain how this code segment would contribute to the overall functionality of a program.
Write your response here

2a. Consider an algorithm in your program that performs a specific task.


(i) Describe this algorithm and its intended result.
(ii) Write a new algorithm that could perform the same task. Compare how the two algorithms function and
explain whether or not they yield the same result or side effect. If it is not possible to write a new algorithm that
produces the same result, explain why.
Write your response here
// Function to calculate the sum of an array of numbers
function add(numbers) {
var sum = 0;
for (var i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
return sum;
}

// Function to calculate the average of an array of numbers


function getAverage(numbers) {
// Check if the array is empty
if (numbers.length === 0) {
console.log("Please add numbers to calculate the average.");
return; // Exit the function if no numbers are provided
}

// Calculate the sum using the add function


var sum = add(numbers);

// Calculate the average by dividing the sum by the number of elements


var average = sum / numbers.length;

// Log the average to the console


console.log("Average = " + average);

// Return the average value


return average;
}

// Example usage:
var numbers = [10, 20, 30, 40, 50];
getAverage(numbers); // This will calculate and log the average of the numbers

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 5


2b. Refer to a function or algorithm in your program that processes input data.
(a) Identify at least two different sets of inputs that you would use to test this algorithm.
(b) Describe the expected output or behavior for each input, and explain how this helps verify that the algorithm
works correctly.
Write your response here

Referring to the getAverage


function in my code, the way to test
to see if it works would be
console.log(getAverage([ 1,2,3,4,5])
); or console.log(getAverage([]) ); .
for the first console log the
expected
output would be 3 and we know that
it works because in the algorithm, it
takes the sum of all the numbers
and divides them by the amount of
numbers which is the point of the
algorithm. For the second console
log,
it should not give an average but
instead say “Please add numbers”
because there were no numbers

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 6


added

2c. Refer to a procedure in your program that performs a specific task.


(a) Explain how this procedure manages complexity in your program by breaking down a larger problem into
smaller tasks.
(b) Describe how using this procedure improves the organization of your program and makes it easier to
maintain or modify.
Write your response here

Referring to the “var average”


variable in my code, it takes the
sum of all the numbers and divides
it by the
amount of numbers added by the
user and labels that answer as the
average. Instead of needing
multiple
pieces of code, the answer is
broken down and stored into 1
variable. This improves the
orginization of the
program by making it so everytime
the program need sto find the
average, it wont have to type out all
Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 7
that
code again but instead that one
function. This also makes it easier
to modify or add other code for the
reason said previously.

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 8


Scoring Guidelines

Written Responses (individual) - In the Written Response the student...

Responses Point

(Question 1) Explains the purpose of the code segment, including what it does and its inputs and outputs. /1

(Question 1) Explains how the code segment contributes to the overall functionality of the program. /1

(Question 2a) Describes the algorithm and its intended result. /1

(Question 2a) Writes a new algorithm to perform the same task, or explains why writing a new algorithm is /1
not possible.

(Question 2a) Compares whether or not the two algorithms produce the same result. /1

(Question 2b) Describes two sets of inputs that can be used to test the algorithm /1

(Question 2b) Describes the output of each input and explains how this helps verify the algorithm works /1
correctly.

(Question 2c) Explains how the function manages complexity in the program /1

(Question 2c) Explains how the function improves organization and makes the program easier to maintain or /1
modify

Program Code

Library includes two or more functions that accomplish related tasks /2

All functions include comments that explain the purpose of the function and the parameters /2

All functions include tests that demonstrate the code working as expected /2

Library code runs without errors /1

Project Guide

Project guide is complete /1

Student provided clear and actionable feedback to a classmate on their project guide /1

Total /14

Computer Science Principles​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 9

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy