Assignments During Shelter at Home

Go back to the lessons in the Computer Science course and go to  Unit 11 Data Structures.  I don’t want you to do the Breakout Challenge in Unit 10 until we get back to class.  Just try to do one lesson every other day for the next two weeks.  If you have questions, submit them to me through the grader on CodeHS or email me.  Otherwise I’ll grade them as you submit them.

Data Structures

11.1 Intro to Lists/Arrays

11.2 Indexing Into an Array

11.3 Adding/Removing From an Array

11.4 Array Length and Looping Through Arrays

11.5 Iterating Over an Array

11.6 Finding an Element in a List

11.7 Removing an Element From an Array

11.8 Array Challenges

3/2-3/6

 Lesson: 3.4 Javadocs and More Methods

Description

Write a method that takes 3 parameters and returns whether num is between min and max inclusive.

The method should be written:

public boolean inRange(int num, int min, int max)

It should return true if num is in between min and max, inclusive and return false otherwise.

Motivation

Building good programs consists of doing more than just writing code. Documenting the code with descriptive comments is also very important. Javadoc is a built-in way of turning comments into readable documentation. Students will practice creating documentation in this exercise.

 Lesson: 3.5 Strings Methods

Description

Write a yell method that turns text into “yelling” text. You should take the given text and make it all upper case.

For example, yell("hello") should return "HELLO".

The method signature should be

public String yell(String text)

Hint: You can use the String method .toUpperCase()

Motivation

Strings are an important part of the Java language, and programming in general. This exercise familiarizes students with one of the widely-used methods for manipulating Strings.

 Lesson: 3.6 Strings and Characters

Description

Given a string, determine if it is an integer. For example the
string “123” is an integer, but the string “hello” is not.

It is an integer if all of the characters in the string are digits.

Return true if it is an integer, or false if it is not.

Hint: There is a method Character.isDigit() that takes a char as an argument
and returns a boolean value.

Motivation

Being able to take strings apart and access the characters within is a useful skill. Students will practice accessing the characters of a string in this exercise.

 Lesson: 3.7 Exceptions

Description

This program is called Bug Hunter. It searches for the String “bug” inside of other Strings.

Unfortunately, Bug Hunter has several compile time errors, so it won’t run.

Your job is to find all the compile time errors in the Bug Hunter program and fix them so that the program runs!

When the program is successfully debugged, it should output:

Debug has a bug at index 2
bugs bunny has a bug at index 0
boogie has no bugs
baby buggie has a bug at index 5

Motivation

Students learn how to debug compile time errors.

 Lesson: 3.8 String Processing

Description

The method

String sumString(int one, int two)

Is intended to return a String representing the sum of one and two.
For example:

sumString(6, 10)

Should return a String of the form

6 + 10 = 16

But it is currently returning a String of the form

6 + 10 = 610

Your job is to debug this method so that it returns the proper String!

Motivation

Students continue to practice their debugging skills.

2/24-2/28

 2.5.4 Casting to an Int


Description

Write a program that casts the double value 3.14 into an integer.
Print this value to the screen.

Motivation

Working with data of different types is an important part of programming in Java. In this exercise, students will practice casting one data type into another.

 2.5.5 Casting to a Double

Description

Use casting to write a program that prints the division of the integers 3 and 4. Make sure to print a double!
Your program should print 0.75 to the screen.

Motivation

When dividing numbers, it is important to pay attention to whether you want to “save” any remainder. If two ints are divided, the result will be an int, meaning that there will be no decimal portion. To get the complete answer including decimals, at least one number needs to be a double.

 2.5.8 Movie Ratings


Description

Movies always come with ratings. A bad movie may have 1.4 stars, and a great movie may have 4.9 stars.

Your job is to write a program that gets a movie rating from the user as a double, and then rounds to the nearest int using the rounding with casting technique.

 2.6.4 Ice Cream


Description

In this exercise, write a program that asks the user whether or not they like ice cream.
Save the answer as a boolean and print it to the screen.

2/18-2/21

Lesson: 2.1 Printing in Java

Now that you’re comfortable using basic Java commands, it’s time to move into the Java console environment.

  • This program extends ConsoleProgram instead of Karel. This tells the program that it’s going to use the console instead of a Karel grid world.
  • The text is printed to the console with the System.out.println() command.

Lesson: 2.2 Variables and Types

Variables allow us to store information such as numbers, words, or true/false expressions. A variable can be thought of as a box that stores information inside. In Java, variables are composed of three things: a name, type, and value.

Lesson: 2.3 User Input

Being able to obtain user input creates new opportunities while coding. This allows us to take in data from the user to make our programs work for them.

Lesson: 2.4 Arithmetic Expressions

Arithmetic Expressions allow us to perform mathematical operations within Java.

Such expressions can be used for basic math and even more complex algorithms.

2/10-2/14


In this unit, students will bring together everything they have learned in the course to create a fully functional game. This takes several days to complete

Objective

Students will be able to:

  • Synthesize the skills and concepts from Java Script Control Structures, Functions and Parameters, and Animation and Games to create their very own Breakout game from scratch!
  • Break down a large problem into smaller parts using Top Down Design, and solve each of these smaller parts using functions
  • Create helpful comments with preconditions and postconditions to help the reader understand the code
  • Find and fix bugs in large programs

2/3-2/7


In this unit, students will bring together everything they have learned in the course to create a fully functional game. This takes several days to complete

Objective

Students will be able to:

  • Synthesize the skills and concepts from Java Script Control Structures, Functions and Parameters, and Animation and Games to create their very own Breakout game from scratch!
  • Break down a large problem into smaller parts using Top Down Design, and solve each of these smaller parts using functions
  • Create helpful comments with preconditions and postconditions to help the reader understand the code
  • Find and fix bugs in large programs

1/27-1/31


In this lesson, students learn how to extend mouse events to make interactive animations using the dragging motion of the mouse.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the mouse moving

In this lesson we continue to use user input via the mouse to create interactive programs.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the mouse moving.

In this lesson, students will learn how to use keyboard keys to control events. Keyboard events capture when the user presses keys on the keyboard. This allows students to write programs that take input from the keyboard to change what is happening in the program.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the keyboard input.

In this lesson, students will create programs that combine multiple ideas from this unit.

Objective

Students will be able to:

  • Synthesize the skills and concepts learned in the Animation and Games unit to create advanced, interactive programs.

In this lesson, students review content with a 25 question End-of-Unit Quiz.

Objective

Students will be able to:

  • Prove their knowledge of various concepts in animation through a multiple choice quiz

1/21-1/24


In this lesson, students learn how to extend mouse events to make interactive animations using the dragging motion of the mouse.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the mouse moving

In this lesson we continue to use user input via the mouse to create interactive programs.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the mouse moving.

In this lesson, students will learn how to use keyboard keys to control events. Keyboard events capture when the user presses keys on the keyboard. This allows students to write programs that take input from the keyboard to change what is happening in the program.

Objective

Students will be able to:

  • Explain how events are different from timers.
  • Create interactive programs that use events to respond to the keyboard input.

In this lesson, students will create programs that combine multiple ideas from this unit.

Objective

Students will be able to:

  • Synthesize the skills and concepts learned in the Animation and Games unit to create advanced, interactive programs.

1/13-1/17


In this lesson, students will be introduced to the concept of using timers for animation. Now instead of having graphics programs that stay the same, the content changes every time the timer runs. The first program students will see is a moving ball, so discussing this with the class as a demo on the projector is very useful.

Objective

Students will be able to:

  • Explain in their own words how animation works
  • Create animation in programs using the setTimer function
  • Explain what a callback function is

In this lesson, we’ll look at more examples with timers and start making more interesting animations. Students will use timers and the Randomizer to create animations on the canvas.

Objective

Students will be able to:

  • Create programs with timers to create increasingly challenging animations
  • Analyze existing programs and explain how they create animations
  • Utilize the Randomizer to generate random events in their animations

In this lesson, students use timers in combination with the other ideas they have learned, including more graphics as well as coordinate math to create different objects. The random ghosts serves as a fun example to show how you can modify things once you have the basic building blocks in place to make them more readable and easier to alter.

Objective

Students will be able to:

  • Explain the general workflow of creating an animation program
  • Analyze animation programs and identify similarities and differences
  • Create increasingly challenging animations using timers, graphics, and the Randomizer

In this lesson, students build on the use of timers and utilize if statements inside timers to dynamically change what the animations are doing.

Objective

Students will be able to:

  • Create increasingly challenging animations that simulate movement using timers

1/7-1/10


In this lesson, students will be introduced to the concept of using timers for animation. Now instead of having graphics programs that stay the same, the content changes every time the timer runs. The first program students will see is a moving ball, so discussing this with the class as a demo on the projector is very useful.

Objective

Students will be able to:

  • Explain in their own words how animation works
  • Create animation in programs using the setTimer function
  • Explain what a callback function is

In this lesson, we’ll look at more examples with timers and start making more interesting animations. Students will use timers and the Randomizer to create animations on the canvas.

Objective

Students will be able to:

  • Create programs with timers to create increasingly challenging animations
  • Analyze existing programs and explain how they create animations
  • Utilize the Randomizer to generate random events in their animations

In this lesson, students use timers in combination with the other ideas they have learned, including more graphics as well as coordinate math to create different objects. The random ghosts serves as a fun example to show how you can modify things once you have the basic building blocks in place to make them more readable and easier to alter.

Objective

Students will be able to:

  • Explain the general workflow of creating an animation program
  • Analyze animation programs and identify similarities and differences
  • Create increasingly challenging animations using timers, graphics, and the Randomizer

In this lesson, students build on the use of timers and utilize if statements inside timers to dynamically change what the animations are doing.

Objective

Students will be able to:

  • Create increasingly challenging animations that simulate movement using timers
Skip to toolbar