Please enable JavaScript to use CodeHS

AP Computer Science A (Mocha)

Description

In this lesson, students will explore methods in Java. Methods help us organize our code into reusable parts, so we don’t have to write the same code over and over again. This makes code easier to understand and manage.

Objective

Students will be able to:

  • Explain the purpose of methods
  • Create their own methods
  • Utilize methods to solve simple problems
Description

In this lesson, students are introduced to parameters. Parameters act as inputs for methods. Imagine methods as boxes, with parameters being the items placed inside these boxes. By using parameters, methods become more versatile, allowing them to handle different versions of the same problem.

Objective

Students will be able to:

  • Explore code examples that include methods and parameters
  • Write methods that take parameters as inputs
  • Apply knowledge of methods and parameters to solve coding exercises
Description

In this lesson, students will expand their understanding of methods by creating reusable code blocks to perform calculations and return values. They will practice creating methods that calculate and return various values, such as sums, doubled numbers, squares, and averages.

Objective

Students will be able to:

  • Explain the purpose of returning a value from a method
  • Create methods that return values
  • Create programs that call methods with return values and store the result for later use
  • Practice creating methods to perform specific calculations
  • Apply method concepts to solve coding exercises
Description

This lesson introduces Javadocs, which is a standard way to comment Java code. Students will also complete various coding exercises to practice creating methods with return values. By the end of the lesson, students will be able to write well-structured and documented code using methods and Javadocs.

Objective

Students will be able to:

  • Demonstrate an understanding of the purpose and syntax of Javadoc comments
  • Analyze a given program for proper documentation
  • Compare and contrast programs with good documentation against programs with poor documentation
  • Write methods that perform specific calculations and return values
  • Use Javadoc comments to document methods
Description

In this lesson, students will learn about String methods. They’ll explore a code example that demonstrates String indexing and looping. Students will then complete coding exercises where they write methods that transform Strings in various ways, including converting text to uppercase, adding specific prefixes, and formatting names. Through these exercises, students will simulate real-world text manipulation scenarios!

Objective

Students will be able to:

  • Read documentation for how to use the methods of the String class
    • Either in the DOCS tab in the CodeHS editor, or elsewhere online
  • Call methods on String objects to get information about the string, such as length or characters at given indices
  • Utilize String methods to create programs that manipulate strings in different ways
Description

In this lesson, students will explore concepts related to Strings and characters in Java, such as Strings vs characters, escape sequences, and methods from the Character class.

Objective

Students will be able to:

  • Demonstrate an understanding of the differences between Strings and characters
  • Examine how characters can be treated as numbers through their ASCII values
  • Practice converting between char values and int values
  • Print out special characters like quotes and new lines using escape sequence chars (such as \n and \")
  • Utilize Character class methods
Description

Did you know that when a bug occurs in your program, Java helps by throwing an Exception? This exception provides valuable information about where the bug is and what kind of problem is happening. Remember, bugs are a normal part of programming and offer clues to fix issues in our code. In today’s activity, students will explore different types of exceptions and learn how they can assist in debugging. Through various exercises, students will practice identifying these errors and applying solutions, enhancing their ability to effectively debug their programs.

Objective

Students will be able to:

  • Demonstrate an understanding of syntax errors, compiler errors, run-time errors, and logic errors
  • Identify arithmetic exceptions
  • Use comments to identify errors and explain what caused it
  • Utilize exceptions to find and fix bugs in programs
Description

So far, students have explored how to write their own methods that accept parameters and return values, and have learned how Strings and characters interact. They’ve also learned to use methods from the String and Character classes and how to loop through a String’s characters using a for loop. In this lesson, students will combine these skills and write methods for more advanced String manipulations.

Objective

Students will be able to:

  • Create methods that perform advanced manipulations on Strings and characters
  • Develop pseudocode algorithms for solutions before writing the actual Java code
  • Debug their code
  • Practice the common algorithm for String manipulation, including:
    • Looping through each character of the String
    • Performing specific actions based on each character
    • Building a result String by appending processed characters to an initially empty String
    • Returning the final result String
Description

In this lesson, students will apply everything they learned from the Methods Unit to complete a multiple-choice summative assessment. The assessment will cover concepts such as parameters, procedures, methods, Javadoc, debugging, errors, method calls, and method syntax.

Objective

Students will be able to:

  • Demonstrate an understanding of the concepts covered in the Methods Unit through a multiple choice quiz