unit 6 assignment array statistics

# Unit 6: Array

# lesson 1: one-dimensional arrays, # lesson 2: traversing an array, # lesson 3: arrays of strings, # lesson 4: algorithms on arrays, # lesson 5: the enhanced for loop, # assignment 6: array statistics.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Source code for the 2022-23 AP Computer Science A course on Project Stem.

ricky8k/APCSA-ProjectStem

Folders and files, repository files navigation.

Project Stem Logo

APCSA Project Stem

Source code for the 2022-23 AP Computer Science A course on Project Stem. Browse the source code »

This repository contains the source code to various problems on Project Stem. Organized by unit, you will find the necessary activity files to be compiled by the Java environment, as well as runner files provided by Project Stem to test execution (when available).

The provided source code is intended to work with the 2023 AP CS A course. These solutions may grow out-of-date as new changes are made to the course every year.

The user-friendly website front-end found here is built using Retype .

Table of Contents

  • Unit 1: Primitive Types
  • Unit 2: Using Objects
  • Unit 3: Boolean Expressions and If Statements
  • Unit 4: Iteration
  • Unit 5: Writing Classes
  • Unit 6: Array
  • Unit 7: ArrayList
  • Unit 8: 2D Array
  • Unit 9: Inheritance
  • Unit 10: Recursion

đź“ť Contributing

Notice a typo or error? Feel free to create an issue !

Please note that support will not be provided for code that does not work in newer lessons. As such, the source code will not be updated to reflect newer curricula.

This repository is licensed under GPL 3.0 .

Contributors 2

@ricky8k

  • Java 100.0%

Goldie's AP® Computer Science A Coding Projects for Unit 6: Arrays

Show preview image 1

Also included in

unit 6 assignment array statistics

Description

AP® Computer Science A (AP® CSA)

Coding Projects with Arrays

The material covered in these projects aligns with Unit 6 of the AP® CSA CED. These projects ask students to code in the Java programming language.

All projects come with both the editable WORD document, the PDF version, as well as an answer key. You will have the ability to change directions or edit anything to fit your own classroom needs.

Daycare Statistics Project – Students are taken through the steps to import a data file into their program, put the contents into an array, and then work with the common array algorithms.

Multiplication Facts Practice Project – Students will use arrays to make a program that helps the user practice their multiplication facts.

Sum of Two Dice Simulator Project – Statistics and Computer Science cross over in this program where students will simulate rolling a die a certain number of times and use arrays to store their answers.

***********************************************************************************

Interested in more AP® CSA material? You can find these Unit 6 coding projects in the following resources:

Goldie's AP® Computer Science A UNIT 6 PLANS - Arrays

Goldie's FULL CURRICULUM for AP® Computer Science A

Explore my other Java Coding Projects resources:

Unit 1: Primitive Types Coding Projects

Unit 2: Using Objects Coding Projects

Unit 3: if Statements Coding Projects

Unit 4: Iteration Coding Projects

Unit 5: Writing Classes Coding Projects

Unit 6: Arrays Coding Projects

Unit 7: ArrayLists Coding Projects

Unit 8: 2D Arrays Coding Projects

Unit 9: Inheritance Coding Projects

Unit 10: Recursion Coding Projects

Goldie's AP® Computer Science A Coding Projects Bundle

If you need extra explanations or additional guidance, I would love to help!!

AP® is a registered trademark of the College Board® which does not endorse this product.

I want to provide the best possible resources to help other teachers out! You will be notified of any future updates and additions to this product and it will be free of charge. Your support is important and I thank you for allowing me to continue doing what I love to do.

© Goldie’s Math Emporium, LLC

This work is bound by copyright laws and editing (beyond your own classroom use), selling, redistributing, or posting all or part of these documents on the Internet is strictly prohibited. Violations are subject to the Digital Millennium Copyright Act.

Questions & Answers

Goldie's math emporium.

  • We're hiring
  • Help & FAQ
  • Privacy policy
  • Student privacy
  • Terms of service
  • Tell us what you think

pep

Find what you need to study

Unit 6 Overview: Array

3 min read • january 8, 2023

Athena_Codes

Athena_Codes

The Big Takeaway Of This Unit

Unit overview, exam weighting.

  • 10-15% of the test
  • Roughly  4 to 6  multiple-choice questions
  • A possible topic of  FRQ #3 , which may test your ability to  make arrays and array algorithms .

Enduring Understanding

In this unit, we will start learning about  data structures , which are structures that store multiple pieces of data. You will learn about three of them in this course: 1-D Arrays in this unit, ArrayLists in Unit 7, and 2-D Arrays in Unit 8.  Arrays store one type of data, whether that be a primitive data type or a reference data type , and they are of fixed size . When used for loops , we can do many things with arrays and build algorithms with them, as well.

Building Computational Thinking

In this unit, you will learn three things that are important for larger programs: how to create an array, how to  traverse (going through all the elements) an array, and how to manipulate the elements in an array. One of the common mistakes that you may make at first is an ArrayIndexOutOfBoundsException , which occurs when you try to access an element where none exists, but with some practice, you will be flawless with arrays !

Main Ideas for this Unit

  • Initializing Arrays

Accessing Elements in Arrays

Traversing Arrays

  • Array Algorithms

6.1: Array Creation and Access

Introduction to arrays.

Arrays  are used to store one type of data, whether it is a primitive or reference data type . Arrays themselves are reference types. They are best thought of as a list of items with a fixed size , as arrays have a set size that cannot be changed (don’t confuse this with ArrayLists which can also be thought of as a list). Arrays are denoted by braces ({}), with items separated by commas such as the following:

Before we can use arrays , we need to have an import statement, which is

Making Arrays

There are two ways to make arrays : using a constructor and using a pre-initialized array.

Constructor

As with other reference types, we can initialize arrays using a constructor . However, the constructor is slightly different from the constructors from Unit 5:

The items in the array are initialized differently depending on the data type. Integers are initialized to 0, doubles are initialized to 0.0, booleans are initialized to false, and all reference types are initialized to null. We will talk about filling constructed lists in the next topic when we discuss traversing arrays .

Pre-initialized Arrays

We can also set an array to a pre-initialized array, similar to how we initialize strings. Here, we will initialize an array of 10 integers as follows:

We access elements in arrays using bracket notation as follows:  arrayName[index] . The most important thing to know is that Java is a  zero-indexed language ,  so the first item has index 0, and not 1.

Before we talk about the index of the last item, we need to discuss how to find the array length. The array length is actually an instance variable specific to that particular array denoted as  arrayName.length  (not to be confused with length() for Strings). Note that this is not a method, so there are no parentheses. Thus, the last item in the array can be accessed by using  arrayName.length - 1 . Do not confuse this with the constructor in which we use  arrayName.length in brackets. If we use an index outside the allowed range, we will get an  ArrayIndexOutOfBoundsException .

Here is a question: how do we access the even numbers in arrayOne from above?

2 = arrayOne[1]

4 = arrayOne[3]

6 = arrayOne[5]

8 = arrayOne[7]

10 = arrayOne[9]

Key Terms to Review ( 13 )

ArrayIndexOutOfBoundsException

arrayName.length

arrayName[index]

Primitive data type

Reference Data Type

Zero-indexed language

Fiveable

About Fiveable

Code of Conduct

Terms of Use

Privacy Policy

CCPA Privacy Policy

AP Score Calculators

Study Guides

Practice Quizzes

Cram Events

Crisis Text Line

Help Center

Stay Connected

© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

unit 6 assignment array statistics

  • Table of Contents
  • Course Home
  • Assignments
  • Peer Instruction (Instructor)
  • Peer Instruction (Student)
  • Change Course
  • Instructor's Page
  • Progress Page
  • Edit Profile
  • Change Password
  • Scratch ActiveCode
  • Scratch Activecode
  • Instructors Guide
  • About Runestone
  • Report A Problem
  • 6.1 Array Creation and Access
  • 6.2 Traversing Arrays with For Loops
  • 6.3 Enhanced For-Loop (For-Each) for Arrays
  • 6.4 Array Algorithms (FRQs)
  • 6.4.1 Free Response - Horse Barn A
  • 6.4.2 Free Response - Horse Barn B
  • 6.4.3 Free Response - Self Divisor B
  • 6.4.4 Free Response - Sound A
  • 6.4.5 Free Response - Sound B
  • 6.4.6 Free Response - Number Cube A
  • 6.4.7 Free Response - Number Cube B
  • 6.5 Unit 6 Summary
  • 6.6 Mixed Up Code Practice
  • 6.7 Toggle Mixed Up or Write Code Practice
  • 6.8 Code Practice with Arrays
  • 6.9 Multiple-Choice Exercises
  • 6.10 Practice Exam for Arrays
  • 6.11 More Code Practice with Arrays
  • 6.4.7. Free Response - Number Cube B" data-toggle="tooltip">
  • 6.6. Mixed Up Code Practice' data-toggle="tooltip" >

6.5. Unit 6 Summary ¶

In this chapter you learned about Arrays . An array is consecutive storage for multiple items of the same type like the top five scores in a game. You learned how to declare arrays, create them, and access array elements. Array elements are accessed using an index. The first element in an array is at index 0.

../_images/arrayIndicies.png

Figure 1: Two 5 element arrays with their values set to the default values for integer and object arrays. ¶

6.5.1. Concept Summary ¶

Array - An array can hold many items (elements) of the same type. You can access an item (element) at an index and set an item (element) at an index.

Array Declaration - To declare an array specify the type of elements that will be stored in the array, then ( [] ) to show that it is an array of that type, then at least one space, and then a name for the array. Examples: int[] highScores; String[] names;

Array Creation - To create an array type the name and an equals sign then use the new keyword, followed by a space, then the type, and then in square brackets the size of the array (the number of elements it can hold). Example: names = new String[5];

Array Index - You can access and set values in an array using an index. The first element in an array called arr is at index 0 arr[0] . The last element in an array is at the length minus one - arr[arr.length - 1] .

Array Initialization - You can also initialize (set) the values in the array when you create it. In this case you don’t need to specify the size of the array, it will be determined from the number of values that you specify. Example: int[] highScores = {99,98,98,88,68};

Array Length - The length of an array is the number of elements it can hold. Use the public length field to get the length of the array. Example: given int[] scores = {1,2,2,1,3,1}; , scores.length equals 6.

Element Reference - A specific element can be referenced by using the name of the array and the element’s index in square brackets. Example: scores[3] will return the 4th element (since index starts at 0, not 1). To reference the last element in an array, use array[array.length - 1]

For-each Loop - Used to loop through all elements of an array. Each time through the loop the loop variable will be the next element in the array starting with the element at index 0, then index 1, then index 2, etc.

Out of Bounds Exception - An error that means that you tried to access an element of the array that doesn’t exist maybe by doing arr[arr.length] . The first valid indices is 0 and the last is the length minus one.

6.5.2. Java Keyword Summary ¶

for - starts both a general for loop and a for-each loop. The syntax for a for each loop is for (type variable : array) . Each time through the loop the variable will take on the next value in the array. The first time through the loop it will hold the value at index 0, then the value at index 1, then the value at index 2, etc.

static - used to create a class method, which is a method that can be called using the class name like Math.abs(-3) .

6.5.3. Vocabulary Practice ¶

  • The index of the last element
  • The number of elements in the array
  • The index of the first element
  • The index of the second element
  • Declare an integer array named nums
  • int[] nums;
  • Declare and create a String array named list1 that can hold 3 elements
  • String[] list1 = new String[3];
  • Initialize an array of integers named nums to contain the first 3 whole numbers
  • int[] nums = {1,2,3};
  • Initialize a String array named list1 to contain the first 3 letters of the alphabet as separate strings
  • String[] list1 = {"a", "b", "c"};

For more practice, see this Quizlet .

6.5.4. Common Mistakes ¶

forgetting to create the array - only declaring it ( int[ ] nums; ) using 1 as the first index not 0 using array.length as the last valid index in an array, not array.length - 1 . using array.length() instead of array.length (not penalized on the free response) using array.get(0) instead of array[0] (not penalized on the free response) going out of bounds when looping through an array (using index <= array.length ). You will get an ArrayIndexOutOfBoundsException . jumping out an loop too early by using one or more return statements before every value has been processed.

IMAGES

  1. Assignment 6: Array Statistics : r/EdhesiveHelp

    unit 6 assignment array statistics

  2. Assignment Unit 6 Completed

    unit 6 assignment array statistics

  3. Unit 3 assignment part2

    unit 6 assignment array statistics

  4. Unit 6 assignment 1

    unit 6 assignment array statistics

  5. Assignment 6 array statistics : r/EdhesiveHelp

    unit 6 assignment array statistics

  6. MT445 Unit6 Assignment Rubric 3 .docx

    unit 6 assignment array statistics

VIDEO

  1. What are React Components

  2. MGT402 (Cost & Management Accounting) Quiz No.2 Solution Spring 2024

  3. Programming Assignment: Array and object iteration Week 3

  4. Unit 6 Assignment: Youtube

  5. STA301 (Statistics and Probability) Quiz No.2 Solution Spring 2024

  6. MN 552 Unit 6 Assignment Part 1

COMMENTS

  1. # Unit 6: Array

    # Unit 6: Array # Lesson 1: One-Dimensional Arrays ... # Assignment 6: Array Statistics Coding Activity StudentStatsArray.java. public class StudentStatsArray { private final Student[] students; // Constructor for students array public StudentStatsArray(Student[] students) { this.students = students; } // Returns the average gpa of the students ...

  2. Jovakan/apcsa2020: Answer key for APCSA Edhesive 2020

    This repository is organized into the units and lessons inside them. You will also find the assignments but you will find no answers to any of the reviews, quizzes, or exams.

  3. APCSA 2020 : r/EdhesiveHelp

    Here is every assignment and coding lesson for APCSA 2020. Hope this helps :) APCSA 2020. Thank you so much! for assignment 6: array statistics, do you have to copy and paste all three parts or just one? If you look on the side of the compiler theirs a 3 tabs with separate parts.

  4. Assignment 6: Array Statistics : r/EdhesiveHelp

    Assignment 6: Array Statistics . Java Need help with the unit 6 assignment anyone has the answer? Locked post. New comments cannot be posted. Share Sort by: Best. Open comment sort options. Best. Top. New. Controversial. Old. Q&A. Add a Comment.

  5. GitHub

    Unit-6 Unit-7. Unit-7 ... Unit 6: Array; Unit 7: ArrayList; Unit 8: 2D Array; Unit 9: Inheritance; Unit 10: Recursion; đź“ť Contributing. Notice a typo or error? Feel free to create an issue! Please note that support will not be provided for code that does not work in newer lessons. As such, the source code will not be updated to reflect newer ...

  6. Unit 6 Assignment: Array Statistics : r/EdhesiveHelp

    If you need answer for a test, assignment, quiz or other, you've come to the right place. ... ADMIN MOD Unit 6 Assignment: Array Statistics . Java I have everything except for the toString() method. I need help/the answer for the toString() method. Plz help!! Share Sort by: Best. Open comment sort options. Best. Top. New ...

  7. APCS Unit 6 (Part 1): Arrays In-Depth Review and Practice Test

    This video part 1 of the full in-depth review of AP Computer Science A Unit 6: Arrays! In this video, I will go over review for Unit 6.Unit 6 Practice Test P...

  8. Unit 6 Overview: Array

    Exam Weighting. 10-15% of the test; Roughly 4 to 6 multiple-choice questions; A possible topic of FRQ #3, which may test your ability to make arrays and algorithms.; Enduring Understanding. In this unit, we will start learning about data structures, which are structures that store multiple pieces of data.You will learn about three of them in this course: 1-D Arrays in this unit, ArrayLists in ...

  9. 6. Arrays

    6.5 Unit 6 Summary; 6.6 Mixed Up Code Practice; 6.7 Toggle Mixed Up or Write Code Practice; 6.8 Code Practice with Arrays; ... Arrays¶ Class Periods: 6-8. AP CSA Exam Weighting: 10-15%. 6.1. Array Creation and Access. 6.1.1. Declaring and Creating an Array; 6.1.2. Using new to Create Arrays;

  10. Goldie's AP® Computer Science A Coding Projects for Unit 6: Arrays

    Description. AP® Computer Science A (AP® CSA) Coding Projects with Arrays. The material covered in these projects aligns with Unit 6 of the AP® CSA CED. These projects ask students to code in the Java programming language. All projects come with both the editable WORD document, the PDF version, as well as an answer key.

  11. AP Computer Science A Unit 6 Review

    AP CSA: Unit 2 and 3 Review. T. streamed by Tejas Bhartiya. Study guides & practice questions for 5 key topics in AP CSA Unit 6 - Array.

  12. unit6

    UNIT #6: ARRAYS _____ ELEMENTARY STATISTICS: Announcements: You must be careful with the naming of your programming assignment file. If in doubt please contact us. Looping around data: Array - the devise that let us handle with ease a great number of variables. Choose the shape to fit your engineering problem ( One dimensional, Two dimensional ...

  13. AP Computer Science A

    lets hopefully not fail this time! Learn with flashcards, games, and more — for free.

  14. PDF Assignment 6 CEC

    Assignment 6 Static Methods & Array Basics CEC - Computer Science Instructor: M. Wolverton Items Due ... Write a command line program that simulates statistics for rolls of six-sided dice pairs. The program should simulate a requested number of random dice rolls, then report back the total number of results for each value rolled (e.g. 2's ...

  15. Unit 6 Overview: Array

    Unit Overview Exam Weighting. 10-15% of the test; Roughly ; 4 to 6 multiple-choice questions A possible topic of FRQ #3, which may test your ability to make arrays and array algorithms. Enduring Understanding. In this unit, we will start learning about data structures, which are structures that store multiple pieces of data.You will learn about three of them in this course: 1-D Arrays in this ...

  16. algebra 2b

    step 1 : laura decides she will investigate the question, "does tutoring improve students' grades?" step 2 : laura randomly assigns students to a tutoring program or a control condition. she then collects information on their grades when the program is finished. step 3 : laura analyzes her data and finds that students in the tutoring program ...

  17. Unit 6 Assignment:Statistics. Does anybody have answer???

    import java.util.Arrays; public class StringStatsArray{ //Add a final private variable to hold String array private final String[] holder; public StringStatsArray(String[] a){ //Write constructor code holder = a; }

  18. 6.5. Unit 6 Summary

    Unit 6 Summary — AP CSAwesome. 6.5. Unit 6 Summary ¶. In this chapter you learned about Arrays. An array is consecutive storage for multiple items of the same type like the top five scores in a game. You learned how to declare arrays, create them, and access array elements. Array elements are accessed using an index.

  19. AP Computer Science

    W Learn with flashcards, games, and more — for free.

  20. Any1 got APCSA assignment 6: array statistics? : r/EdhesiveHelp

    Wᴇʟᴄᴏᴍᴇ ᴛᴏ ʀ/SGExᴀᴍs - the largest community on reddit discussing education and student life in Singapore! SGExams is also more than a subreddit - we're a registered nonprofit that organises initiatives supporting students' academics, career guidance, mental health and holistic development, such as webinars and mentorship programmes.

  21. Unit 6 array statistics : r/EdhesiveHelp

    Unit 6 array statistics . Java this would be very helpful :) Share Add a Comment. Be the first to comment Nobody's responded to this post yet. ... If you need answer for a test, assignment, quiz or other, you've come to the right place. Members Online. FRQ: Row Compare Part B upvotes r/blender. r/blender. Blender is an awesome open-source ...

  22. APCSA Unit 6

    Arrays are lists that store many values of the same type. Array values are stored at a particular index and we access elements in the array by referencing this index value. Index values in Arrays start a 0. Returns the length of the array. Accesses an element in the array to either update or retrieve.

  23. Help for Assignment 6: Array Statistics : r/EdhesiveHelp

    If you need answer for a test, assignment, quiz or other, you've come to the right place. Members Online • SolidYawn. ADMIN MOD Help for Assignment 6: Array Statistics . Java I'm stuck on it, and I need to finish before tomorrow to pass. Share Add a Comment. Sort by: Best. Open comment sort options ...