ArrayList Day 3 Be able to read AP Mult Choice questions tied to ArrayLists Be able to write a program that uses ArrayLists that analyzes numbers.

Slides:



Advertisements
Similar presentations
1 Finding the Sample Mean  Given: The times, in seconds, required for a sample of students to perform a required task were: 6,  Find the sample mean.
Advertisements

1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
CS150 Introduction to Computer Science 1
Variability Measures of spread of scores range: highest - lowest standard deviation: average difference from mean variance: average squared difference.
Measuring Variability for Symmetrical Distributions.
Objectives The student will be able to: find the variance of a data set. find the standard deviation of a data set. SOL: A
Computer Science: A Structured Programming Approach Using C1 3-7 Sample Programs This section contains several programs that you should study for programming.
Measures of Dispersion Week 3. What is dispersion? Dispersion is how the data is spread out, or dispersed from the mean. The smaller the dispersion values,
Standard Deviation!. Let’s say we randomly select 9 men and 9 women and ask their GPAs and get these data: MENWOMEN
 The data set below gives the points per game averages for the 10 players who had the highest averages (minimum 70 games or 1400 points) during the
Arrays and ArrayLists in Java L. Kedigh. Array Characteristics List of values. A list of values where every member is of the same type. Each member in.
Objectives The student will be able to: find the variance of a data set. find the standard deviation of a data set.
Objectives The student will be able to:  use Sigma Notation  find the mean absolute deviation of a data set SOL: A
© A+ Computer Science - Which of the following statements assigns the letter S to the third row and first column of a two-dimensional.
Homework Assignment #4 J. H. Wang Dec. 3, 2007.
Chapter 4 Practice cont.. Practice with nested loops 1.What will be the output of the following program segment: 1.for (int i = 1; i
Review: Measures of Dispersion Objectives: Calculate and use measures of dispersion, such as range, mean deviation, variance, and standard deviation.
What is Mean Absolute Deviation?  Another measure of variability is called the mean absolute deviation. The mean absolute deviation (MAD) is the average.
Objectives The student will be able to:
Standard Deviation A Measure of Variation in a set of Data.
Mean Absolute Deviation Mean Absolute Deviation, referred to as MAD, is a better measure of dispersion than the standard deviation when there are outliers.
How do you do the following? Find the number of scores within 3 points of the average of 10 scores? What kind of a tool do you need? Today’s notes: Include.
Luka Petrović 69/2012 1/12. The Standard Deviation is a measure of how spread out numbers are. Its symbol is σ (the greek letter sigma) The formula is.
Standard Deviation. Two classes took a recent quiz. There were 10 students in each class, and each class had an average score of 81.5.
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
int [] scores = new int [10];
The ArrayList Data Structure The Most Important Things to Review.
CSE 143 Lecture 3 Implementing ArrayIntList reading: slides created by Marty Stepp and Hélène Martin
2.4 Measures of Variation The Range of a data set is simply: Range = (Max. entry) – (Min. entry)
Chapter 1 Lesson 7 Variance and Standard Deviation.
Objectives The student will be able to: describe the variation of the data. find the mean absolute deviation of a data set.
Normal Distribution Students will be able to: find the variance of a data set. find the standard deviation of a data set. use normal distribution curve.
Chapter 2 The Mean, Variance, Standard Deviation, and Z Scores.
Midpoint Objective: Students will be able to apply the midpoint formula to find endpoints and midpoints of segments.
Standard Deviation, Z- Scores, Variance ALGEBRA 1B LESSON 42 INSTRUCTIONAL MATERIAL 2.
Objectives The student will be able to:
Using Standard Deviation in AP Biology
while Repetition Structure
Objectives The student will be able to:
Dialogues and Wrapper Classes
Objectives The student will be able to: use Sigma Notation
Interfaces.
Control Statement Examples
Java Array Lists 2/2/2016.
Java Array Lists 2/13/2017.
Standard Deviation Calculate the mean Given a Data Set 12, 8, 7, 14, 4
More Loops.
Chapter 8 The Loops By: Mr. Baha Hanene.
Objectives The student will be able to:
int [] scores = new int [10];
ArrayLists.
CSE 143 Lecture 2 Collections and ArrayIntList
Learning Targets I can: find the variance of a data set.
Objectives The student will be able to: find the standard deviation of a data set.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Notes – Standard Deviation, Variance, and MAD
Add, Subtract, Divide and Multiply Integers
Java Array Lists 2/13/2017.
What does the following mean?
Java Array Lists Day 2.
Mean & Standard Deviation
Objectives The student will be able to:
Standard Deviation!.
Objectives The student will be able to:
Dry Run Fix it Write a program
Standard deviation: Measures the average amount that items vary (deviate) from the mean of an entire data set.
Standard Deviation Mean - the average of a set of data
Calculating Standard Deviation
Presentation transcript:

ArrayList Day 3 Be able to read AP Mult Choice questions tied to ArrayLists Be able to write a program that uses ArrayLists that analyzes numbers.

Sample Question 2. Consider the following code segment. ArrayList <Integer> list = new ArrayList<Integer> (); list.add(new Integer(1)); list.add(new Integer(2)); list.add(new Integer(3)); list.set(2, new Integer(4)); list.add(2, new Integer(5)); list.add(new Integer(6)); System.out.println(list); What is printed as a result of executing the code segment? (A) [1, 2, 3, 4, 5] (B) [1, 2, 4, 5, 6] (C) [1, 2, 5, 4, 6] (D) [1, 5, 2, 4, 6] (E) [1, 5, 4, 3, 6] Note: This will display the entire arraylist!! Same as System.out.println(list.toString());

3. Consider the following data field and method. private ArrayList nums; // precondition: nums.size() > 0; // nums contains Integer objects public void numQuest() { int k = 0; Integer zero = new Integer(0); while (k< nums.size()) if (nums.get(k).equals(zero)) nums.remove(k); k++; } Assume that ArrayList nums initially contains the following Integer values. [0, 0, 4, 2, 5, 0, 3, 0] What will ArrayList nums contain as a result of executing numQuest ? (A) [0, 0, 4, 2, 5, 0, 3, 0] (B) [4, 2, 5, 3] (C) [0, 0, 0, 0, 4, 2, 5, 3] (D) [3, 5, 2, 4, 0, 0, 0, 0] (E) [0, 4, 2, 5, 3]

Program Input: 10 scores (integers) Output: The high score The low score The average The number of scores within 3 of the average Push: Support an unknown number of scores Push: Show the numbers in order low to high Input: 10 scores and calculate the standard deviation

Standard Deviation Example. Find the standard deviation of 4, 9, 11, 12, 17, 5, 8, 12, 14 First work out the mean (Average, xbar,…): (4 + 9 + 11 + 12 + 17 + 5 + 8 + 12 + 14)/9 = 10.222 Now, subtract the mean individually from each of the numbers in the question and square the result. This is equivalent to the (x - xbar)² step. x refers to the values in the question. x               4        9        11       12       17       5       8       12      14 (x - xbar)²     38.7   1.49    0.60    3.16    45.9   27.3   4.94   3.16   14.3 Now add up these results (this is the 'sigma' in the formula): 139.55 Divide by n-1. n is the number of values, so in this case n-1 is 8: 139.55 / 8 = 17.44 And finally, square root this: 4.18