Welcome to APCSA

  1. Lesson 31 - Recursive Techniques


    Slides

    ClassworkHomework

  2. Lesson 30 - Recursion


    Slides

    Homework

  3. Lesson 29 - Linked List


    Slides

    Lab

  4. Lesson 28 - Abstract Classes and Interfaces


    Slides

    Lab

  5. Lesson 27 - args main method


    args in public static void main(String[] args)

    Every Java program starts running from the main method. You’ve seen it many times:

    public static void main(String[] args)
    

    But what’s the purpose of String[] args?

    It allows your program to receive input from the command line.

    When you run your program from the terminal, you can pass extra data directly to it. Those pieces of data are stored in an array called args.

    What exactly is args?

    • args is a String array.
    • When you run a java program, each space-separated item typed after the program name becomes one element in that array.

    For example, if you run:

    java MyProgram hello world 1
    

    Then inside your program:

    • args[0] is "hello"
    • args[1] is "world"
    • args[2] is "1"
    • args.length is 3

    Even though "1" looks like a number, it is still a String, because all command-line arguments start as strings.

    How do you use these arguments?

    Here’s a example that prints whatever the user typed:

    public class Fruits {
        public static void main(String[] args) {
            for (int i = 0; i < args.length; i++) {
                System.out.println("Argument " + i + ": " + args[i]);
            }
        }
    }
    

    If you run:

    java Fruits apple banana cherry 1
    

    Output:

    Argument 0: apple
    Argument 1: banana
    Argument 2: cherry
    Argument 3: 1
    

    Converting the arguments

    Since every element of args is a String, you must convert values to numbers if needed:

    int x = Integer.parseInt(args[3]);
    double y = Double.parseDouble(args[3]);
    

    Exercise

    Add two numbers from the command line

    public class AddNums {
        public static void main(String[] args) {
            if (args.length < 2) {
                System.out.println("Please enter two numbers.");
            }
    
            int a = Integer.parseInt(args[0]);
            int b = Integer.parseInt(args[1]);
            int sum = a + b;
    
            System.out.println("The sum is: " + sum);
        }
    }
    

    Running:

    java AddNums 8 12
    

    Output:

    The sum is: 20
    

    Classwork

  6. Lesson 26 - Random


    Slides

    Classwork

  7. Lesson 25 - Sorting Algorithms


    Slides

    Classwork/Homework

    Bubble Sort

  8. Lesson 24 - ArrayList Hierarchy


    Slides

  9. Lesson 23 - Polymorphism


    Slides

    Classwork/Homework

    Complete the exit-ticket on GoogleClassroom.

  10. Lesson 22 - Inheritance (part 2)


    Slides

    Classwork/Homework

  11. Lesson 21 - Inheritance (part 1)


    Slides

    Demo

    Homework

  12. Lesson 20 - File Handling


    Slides

    Classwork

    Homework: Finish CW.

  13. Lesson 19 - ArrayList


    Slides

    Classwork

    Homework

  14. Lesson 18 - Wrapper Classes


    Slides

    Classwork

  15. Lesson 17 - Exceptions


    Slides

    Classwork: Add exceptions to your SuperArray lab.

  16. Lesson 16 - SuperArray


    Slides

    Classwork - Homework

  17. Lesson 15 - Static Methods and Variables


    Slides

  18. Lesson 14 - Objects and Classes


    Part 1

    Part 2

    Example

  19. Lesson 13 - Methods, arguments/parameters, Java pass by value


    Slides

    Classwork

  20. Lesson 12 - 2D Arrays


    Slides

    Classwork

  21. Lesson 11 - More about Arrays


    Slides

    Classwork/Homework

  22. Lesson 10 - Arrays


    Slides

    Classwork/Homework

  23. Lesson 09 - String Methods, Math Class


    Slides

    Classwork: GoogleClassroom assignment

  24. Lesson 08 - Strings and Loops


    Slides

    Java Visualizer

    Homework

  25. Lesson 07 - Java Memory Architecture and Strings


    Slides

    Classwork

    Homework

  26. Lesson 06 - User Input


    Slides

    Classwork

    Homework

  27. Lesson 05 - Casting


    Slides

    Classwork

    Homework

  28. Lesson 04 - Expressions and Assignment Statements


    Slides

    Classwork

  29. Lesson 03 - Data Types and Varialbes


    Slides

  30. Lesson 02 - Intro to Java


    Slides

  31. Lesson 01 - Git


    GitHub

    Read the Git and GitHub documentation provided in the Tools section.

    Git Commands: When to Use Them

    git clone

    When to use:
    Use this the first time you want to copy a remote repository (e.g., from GitHub) to your computer.

    Command:

    git clone <repository_ssh_url>

    Tip: Run this only once per project. After that, use git pull to update your local copy.

    git pull

    When to use: Use this to bring in the latest changes from the remote repository to your local repository.

    Command:

    git pull

    Tip: Always run this before starting new work to make sure your files are up to date.

    git add

    When to use: Use this to stage (mark) new or modified files that you want to include in the next commit.

    Command: For one file git add <file_name> For all changes git add .

    git commit

    When to use: Use this after git add to save a snapshot of your staged changes in the local repository.

    Command:

    git commit -am "Describe the change you made"

    Tip: Write clear and meaningful commit messages so you and others understand the change.

    git push

    When to use: To send your committed changes from your computer to the remote repository (e.g., GitHub).

    Command:

    git push

    Typical Workflow

    1. git pull: get the latest updates.

    2. Edit your code/files.

    3. git add: if new files have been added or to stage your changes.

    4. git commit -am "message": save your changes locally.

    5. git push: upload your changes to GitHub.

  32. Lab 08 - Linked List


    DUE DATE:

    Please accept this assignment.

    Due Date: Friday, December 19, 2025 at 11:59 pm.

  33. Lab 07 - Bank Accounts


    DUE DATE:

    Please accept this assignment.

    Due Date: Friday, December 12, 2025 at 08:00 am.

  34. Lab 06 - Sorting Algorithms


    DUE DATE:

    Please accept this assignment.

    Due Date: Monday, December 8, 2025 at 08:00 am.

  35. Lab 05 - Arraylist Hierarchy


    DUE DATE:

    Please accept this assignment.

    Due Date: Wednesday, November 26, 2025 at 08:00 am.

  36. Lab 04 - SuperArray


    DUE DATE:

    Please accept this assignment.

    Due Date: Thursday, October 30, 2025 at 11:59 pm.

  37. Lab 03 - Triangle


    DUE DATE:

    Please accept this assignment.

    Due Date: Friday, October 24, 2025 at 08:00 am.

  38. Lab 02 - My String Methods


    DUE DATE:

    Please accept this assignment.

    Due Date: Monday, September 29, 2025 at 11:59 pm.

  39. Lab 01 - Random Walker


    DUE DATE:

    Please accept this assignment.

    Due Date: Friday, September 19, 2025 at 08:00 am.

  40. HW 13 - Recursion


    DUE DATE:

    Save your files here: .../APCSA1/apcsa-assignments-fall-YourUsername/homework/12_22_recursion/RecursiveFunctions.java

    Exercise 1: Sum digits

    Write the solution to the following problem:

    Given a non-negative int n, return the sum of its digits recursively (no loops). Do not use strings to solve the problem.

    Example: 12945 -> 1 + 2 + 9 + 4 + 5 = 21

    Hints:

    How to get the digit at the end 12945 => 5?

    How to remove the last digit 12945 => 1294?

    These questions will guide you in finding the solution:

    • What is the base case?
    • Which operations can break up the numbers into a single digit and the rest?
    • What is the recursive case?

    Exercise 2: Fibonacci Sequence

    The sequence follows the rule that each number is equal to the sum of the preceding two numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 … )

    image

    These questions will guide you in finding the solution:

    • What is the recursive case?
    • When do you call the recursive case?
    • What is(are) the base case(s)?

    When you test your fibonacci method:

    1. Check how long it takes to run the method. Run this command in your terminal: time java Fibonacci.java

    2. What is the largest number such that fibonacci(number) fits in an int? (does not overflow)

  41. HW 12 - More Shapes


    DUE DATE:

    Save your files here: .../APCSA1/apcsa-assignments-YourUsername-fall/homework/11_14_more_shapes/

    • Write a superclass Circle. The instance variable should be radius. There will be one constructor to initialize the instance variable. The following methods should be implemented: getRadius(), toString(), getArea().

    • Write a subclass Cylinder which extends from Circle. Define the instance variable height. There will be one constructor to initialize the instance variable. The following methods should be implemented: getHeight(), getVolume(), getArea(), toString(). If you are overriding a method, please use the @Override annotation.

    • Write a Driver.java to test your code.

    image

  42. HW 11 - Shapes


    DUE DATE:

    Save your files here: .../APCSA1/apcsa-assignments-YourUsername-fall/homework/11_13_inheritance_shapes/

    • Create the following classes: Shape (superclass), Rectangle, Triangle, Driver.
    • Rectangle and Triangle should inherit from Shape.
    • Declare private instance variables in class Shape: double height and double width.
    • Write a constructor in class Shape to initialize the values for height and width.
    • Write public methods in class Shape to get/set height and width values: getHeight(), getWidth(), setHeight() and setWidth().
    • Write a method getArea() in both of the subclasses Rectangle and Triangle which calculates and returns the area the result.
    • You will need to define the constructors in Rectangle and Triangle classes (which call the Shape constructor).

  43. HW 10 - WordPair


    DUE DATE:

    1. Finish CW 18.

    2. Directions here. Save your files here: .../APCSA/apcsa-assignments-fall-YourUsername/homework/11_05_WordPair/

  44. HW 09 - Strings and Loops


    DUE DATE:

    CodingBat

    Java Visualizer

  45. HW 08 - Strings


    DUE DATE:

    Complete this CodingBat.

  46. HW 07 - Scanner


    DUE DATE:

    Go inside the folder homework, and create a subfolder 09_15_snooze. Inside this folder, you will write the following java file:

    NoonSnooze.java: This program should ask the user for a number that represents the number of minutes, snooze, that have elapsed since 12:00 pm (noon) and prints the resulting time. Assume a 12-hour clock (with 'am' and 'pm'). You must not use loops. If the snooze value is negative, print a warning message: "No negative values are allowed".

    Examples:

    If the user input is 50, the output should be 12:50 pm

    If the user input is 100, the output should be 1:40 pm

    If the user input is 721, the output should be 12:01 am

    If the user input is 11111, the output should be 5:11 am

    If the user input is -10, the output should be No negative values are allowed

  47. HW 06 - Practice Variables and Expressions


    DUE DATE:

    Go inside the folder homework, and create a folder 09_12_practice. Inside this folder, you will write the following programs:

    1. Write a Java program (Fractions.java). In this program you will initialize 4 integers that represent each part of two fractions, namely the numerator and denominator of the first fraction and the numerator and denominator of the second fraction. Your program should add the two fractions and print out the result.

    For example, a sample program run might look like this:

      The numerator of the first fraction is 1
      The denominator of the first fraction is 2
      The numerator of the second fraction is 2
      The denominator of the second fraction is 5
      The sum of 1/2 + 2/5 = 9/10
    
    1. Write a Java program (WorkShift.java). A doctor works 20 hours, 42 minutes, and 16 seconds in one shift at a hospital. Convert the total shift time into seconds and display that information.

    NOTE: You must use at least ONE compound operator (+=, -=, *=, /=, %=) to complete this program.

    Quiz Reminder

    The Summer Assignment Quiz will be on Tuesday, September 16th

  48. HW 05 - Data Types and Variables


    DUE DATE:

    Data Types and Variables

    Directions: Create a new folder named 09_10_variables inside your homework directory in your assignments repository: .../APCSA1/apcsa-assignments-fall-YourUsername/homework/09_10_variables

    Inside this folder, write the following programs:

    1. Write a Java program (Temperature.java) to convert temperature from Fahrenheit to Celsius degrees. You must use variables.

    Output:

    50.0 degrees Fahrenheit is equal to 10.0 Celsius

    1. Write a Java program (Calculator.java) that calculates the sum of two numbers (int or double). You must use variables.

    Output:

    10 + 12 = 22

    1. Create a file TrickyCalc.java and copy the following code inside. Run the program. Create a file answers.txt or answers.md and respond to the following questions:
    • What do you notice about the mySum value?
    • What is the value of checkResult, and why do we get that result?
    public class TrickyCalc{
       public static void main(String[] args){
           double mySum = 0.1 + 0.1 + 0.1;
           double tmp = 0.3;
           boolean checkResult = mySum == tmp;
    
           System.out.println("0.1 + 0.1 + 0.1 = " + mySum);
           System.out.println(mySum + " == " + tmp + " is " + checkResult);
       }
    }
    
    1. Don’t forget to add your new files to Git, then commit and push your changes. After that, go to GitHub and verify that your files are there. I will not accept any excuses tomorrow if your homework is missing.

    2. Double check that your files are organized like this in your repo:

    apcsa-assignments-YourUsername
      classwork
        09_09_hello_world
          HelloWorld.java
      homework
        09_09_welcome
          Welcome.java
        09_10_variables
          Temperature.java
          Calculator.java
          TrickyCalc.java
          answers.txt or answers.md
    

  49. HW 04 - Git commands practice


    DUE DATE:

    The objective of this homework is to create a java file, add it, commit and push to a remote repository.

    1. In your local machine at home, go to the folder where your assignments repo was cloned ...../APCSA1/apcsa-assignments-fall-YourUsername/, execute git pull and create a folder homework.
    2. Create a folder 09_09_welcome inside the homework folder.
    3. Write a java file Welcome.java (this should be the path ...../APCSA1/apcsa-assignments-fall-YourUsername/homework/09_09_welcome/Welcome.java). In this program, you should introduce yourself. Print two lines to the console using the System.out.println() method.

    In the first line, state your name, and in the second line state your favorite hobby.

    Your output should be in the following form:

    My name is ...
    My favorite hobby is ...
    
    1. Run git status. What does it show?

    2. To add the new file to the repository, run the following command from the root (top-level, ...../APCSA1/apcsa-assignments-fall-YourUsername/) of your repo, not from inside the homework folder:

      git add homework/09_09_welcome/Welcome.java

    3. Run git status again. What does it show this time?

    4. Commit and push the file to your repo.

    5. Go to GitHub, Welcome.java should be there.

    6. Tomorrow, we will pull the changes using the lab machines.

  50. HW 03 - Git


    DUE DATE:

    1. Set up SSH
      Configure your home computer to connect to GitHub using SSH, if you have not done that already.

    2. Accept the Assignments Repository

      • If you haven’t already, accept the assignments repository using this link.
      • After accepting, a repository will be created under your GitHub account.
      • If you run into any issues, contact me.
    3. Clone the Assignments Repository

      • Open your GitHub assignments repository for this class.
      • Click the green Code button, select SSH, and copy the link provided (it will look like git@...).
      • Create a folder named APCSA1 anywhere on your computer.
      • Open your terminal, navigate inside the APCSA1 folder, and run:
        git clone PASTE_THE_LINK_YOU_COPIED_FROM_GITHUB

    Quiz Reminder

    The Summer Assignment Quiz will be on Tuesday, September 16th.

  51. HW 02 - Summer Assignment, Piazza, Git


    DUE DATE:

    Summer Assignment

    1. Follow the next steps to share your CodingBat Summer work with me.
    • Log in to your CodingBat account.
    • Click on prefs
    • Teacher Share section: type the teacher's email jnovillo@stuy.edu
    • Click on Share
    • Update the Memo section: type YourPeriod_YourLastName_YourFirstName (no spaces) like this 1_smith_peter
    • Click on Update Memo
    1. Submit the complete Java program that was assigned (Google Classroom).

    Piazza

    1. Post a question or comment about the summer assignment. Feel free to reply to peer's comment/question to generate a productive discussion.

    GitHub

    1. Set up Git and SSH keys on your home computer and practice using Git commands. If you have any questions, post them on Piazza, and I encourage everyone to help your peers by answering those questions.

  52. HW 01 - Forms


    DUE DATE:

    Complete the following forms:

  53. CW 34 - More Recursion with Strings


    DUE DATE:

    Recursion with Strings

    Implement the following methods and save them here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/01_07_recursion_with_strings/Strings.java

    Print Characters

    Print each character of the string.

    What String method/s do you need?

    What is the base case?

    What is the recursive case?

    Hint: It can be solved using the head-and-tail algorithm (related to the strategy we learned yesterday), which consists of two parts:

    • printing the head of the string (first character), and,
    • recursively printing its tail (the rest of characters).
    public static void printString(String word){
    
    }
    

    Print the string backwards

    What String method/s do you need?

    What is the base case?

    What is the recursive case?

    public static void printReverse(String word){
    
    }
    

    Counting Characters in a String

    Suppose you are writing an encryption program and you need to count the frequencies of the letters of the alphabet. Let’s write a recursive method for this task.

    This method will have two parameters:

    • word: string that will be processed
    • ch: char to store the target character (the one we want to count).

    The method should return an int, representing the number of occurrences of the target character in the string:

    What String method/s do you need?

    What is the base case?

    What is the recursive case?

    public static int countChar(String word, char ch) {
    
    }
    

    Number Letter Counts

    Project Euler - Problem 17

    This problem must be solved using recursion.

    If the numbers 1 to 5 are to are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.

    If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?

    NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.

    Think about the problem:

    First how can you implement this method to return the number in letters:

    public static String numberToWords(int number) {
    
    }
    
    • How can you have a reference to the numbers in words? Should these words be predefined maybe using arrays?
    • How should the possible number cases be implemented?
      • Handling Hundreds: Greater than or equal to 100
      • Handling Tens: 20 to 99
      • Handling Teens: 10 to 19
      • Handling Ones:Less than 10
    • How can you check the value of the number in the recursive method? How to decide whether to use the word for hundreds, tens, teens, or ones?
    • What is the base case?
    • What is the recursive case?
    • What parameter must be sent in each recursive call?

    Let's do it from 1-1000 to have the total number of letters in all those numbers:

    Declare an integer variable 'result' to store total number of letters
    for each number from 1 to 1000
    	call recursive method numberToWords(number here), this return number in words
    	get the length of the word returned from the recursive method and add it to 'result'
    

    Debugging and Testing:

    • Debug the program by running it with small inputs.
    • Test the program with a range of numbers and verify the results.

  54. CW 33 - Recursive String Problems


    DUE DATE:

    CodingBat

  55. CW 32 - Recursion


    DUE DATE:

    CodingBat

  56. CW 31 - Practice Exam


    DUE DATE:

    Practice Exam

  57. CW 30 - Random


    DUE DATE:

    Random

    Save here: .../APCSA1/apcsa-assignments-YourUsername-fakk/classwork/12_05_random/random.txt

    1. Which of the following statements assigns a random integer between 1 and 10, inclusive, to rn ?
    a. int rn = (int) (Math.random()) * 10;
    b. int rn = (int) (Math.random()) * 10 + 1;
    c. int rn = (int) (Math.random() * 10);
    d. int rn = (int) (Math.random() * 10) + 1;
    e. int rn = (int) (Math.random() + 1) * 10;
    

    Answer:

    1. Consider the following code segment, which is intended to assign to num a random integer value between min and max, inclusive. Assume that min and max are integer variables and that the value of max is greater than the value of min.
    double rn = Math.random();
    int num = /* missing code */;
    

    Which of the following could be used to replace /* missing code */ so that the code segment works as intended?

    a. (int) (rn * max) + min
    b. (int) (rn * max) + min - 1
    c. (int) (rn * (max - min)) + min
    d. (int) (rn * (max - min)) + 1
    e. (int) (rn * (max - min + 1)) + min
    

    Answer:

    1. Assume that myList is an ArrayList that has been correctly constructed and populated with objects. Which of the following expressions produces a valid random index for myList?
    a. (int) ( Math.random () * myList.size () ) - 1
    b. (int) ( Math.random () * myList.size () )
    c. (int) ( Math.random () * myList.size () ) + 1
    d. (int) ( Math.random () * (myList.size () + 1) )
    e. Math.random (myList.size () )
    

    Answer:

  58. CW 29 - Insertion Sort


    DUE DATE:

    Directions:

    • You must implement insertion sort. Use the following method signature:

    public static void insertionSort(int[] data)

    • Please do NOT change the method signature.

    • Do not use ArrayList.

    • Your methods must not produce any output when they finish. Although using print statements during debugging is fine, they should be completely removed in your final submission.

    • Once you create an array to test your method, make a copy of it. This allows you to compare the results of your sort with Java’s built-in sort (Arrays.sort(yourArray)), using the original array for your method and the copied array for the built-in method.

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/12_04_insertion_sort/InsertionSort.java

  59. CW 28 - Selection Sort


    DUE DATE:

    Directions:

    • You must implement selection sort. Use the following method signature:

    public static void selectionSort(int[] data)

    • Please do NOT change the method signature.

    • Do not use ArrayList.

    • Your methods must not produce any output when they finish. Although using print statements during debugging is fine, they should be completely removed in your final submission.

    • Once you create an array to test your method, make a copy of it. This allows you to compare the results of your sort with Java’s built-in sort (Arrays.sort(yourArray)), using the original array for your method and the copied array for the built-in method.

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/12_03_selection_sort/SelectionSort.java

  60. CW 27 - Bubble Sort


    DUE DATE:

    Directions:

    • You must implement bubble sort. Use the following method signature:

    public static void bubblesort(int[]data) { }

    • Please do NOT change the method signature.

    • Do not use ArrayList.

    • Your methods must not produce any output when they finish. Although using print statements during debugging is fine, they should be completely removed in your final submission.

    • Once you create an array to test your method, make a copy of it. This allows you to compare the results of your sort with Java’s built-in sort (Arrays.sort(yourArray)), using the original array for your method and the copied array for the built-in method.

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/12_02_bubble_sort/BubbleSort.java

  61. CW 26 - Advent of Code


    DUE DATE:

    Advent of Code 2016

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/11_26_advent_of_code/

    Due date: Wednesday, December 3 at 08:00 am

    Create an account and join leaderboard

    • Go to https://adventofcode.com/2016 and create an account if you do not have one. Otherwise, log in to your account.
    • Click on Leaderboard, then click on Private Leaderboard and join our class leaderboard using this code 3225641-46c1b3bf.

    Classwork/Homework

    • Required: Work on part 1 problems of days 1, 2, 3, 6.

    • Optional: Choose a part 2 problem of days 1, 2, 3, 6. Or any other harder problem(s).

    HAVE FUN!!!

  62. CW 25 - Numbers


    DUE DATE:

    Directions

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/11_19_inheritance_numbers/

    Due Date: November 24 - 8:00 am

  63. CW 24 - Inheritance Worksheet


    DUE DATE:

    Worksheet

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/11_18_inheritance_worksheet/answers.txt

  64. CW 23 - Library


    DUE DATE:

    Directions

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/11_17_library_books/

  65. CW 22 - Count Triangles


    DUE DATE:

    Directions

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/11_12_count_triangles/

  66. CW 21 - File Handling


    DUE DATE:

    Directions

    Save here: .../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_10_file_handling/

  67. CW 20 - FRQs


    DUE DATE:

    APCS FRQ Practice Assignment

    Instructions:

    • You will work on the APCSA FRQs from last year.

    • You do not need to create Java files.

    • Simply write the method(s) that each question asks for.

    • You do NOT need to write the entire class, only the required methods.

    • Save your answers in one file using any of these formats: .txt, .md, .docx, or .pdf.

    • Complete the exit-ticket on GoogleClassroom at the end of the period.

    Submissions

    1. Progress Submission (In-Class Work)

    Upload your current progress by the end of the period today (Friday, 11/07).

    This submission is required for full credit.

    Save here: ../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_07_FRQs_in_class/

    1. Final Submission (All 4 FRQs Completed)

    Submit all four completed FRQs in one file by Monday, 11/10 at 08:00 am.

    Save here: ../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_07_FRQs_final/

  68. CW 19 - ClimbInfo and CodingBat


    DUE DATE:

    Part 1

    Directions have been posted here

    Save here: .../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_06_ClimbInfo/

    Part 2

    CodingBat

  69. CW 18 - ArrayList


    DUE DATE:

    Directions have been posted here

    Save here: .../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_05_ArrayList/

  70. CW 17 - Wrapper Classes


    DUE DATE:

    Directions have been posted here

    Save here: .../APCSA/apcsa-assignments-fall-YourUsername/classwork/11_03_wrapper_classes/

  71. CW 16 - SuperArray


    DUE DATE:

    Directions have been posted here.

    Save here: .../APCSA/apcsa-assignments-fall-YourUsername/classwork/10_23_super_array/

  72. CW 15 - Coordinates Day 2


    DUE DATE:

    Go here

    Look at the Driver file, and follow the directions.

  73. CW 14 - Coordinate


    DUE DATE:

    Part 1

    Answer these questions:

    1. Can you call a static method from a non-static one?
    2. Or vice versa, can you call a non-static method from a static one?
    3. Try that in your class Employee, and write your answers as comments at the end of your Employee class.

    Part 2

    We want to implement (write) a class Point, which fields represent a 2D coordinate (x, y). Let's think about the class design.

    1. How many instance variable are needed? Private or Public?
    2. What constructors should be needed?
    3. What methods do you think should be needed?
    4. Would it be possible to make the Point class immutable? If so, how?

    Write your answers to those questions in a txt or md.

    Save here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/10_15_coordinate/answers.txt

    Part 3

    Go here and copy the files Point.java and Driver.java in your folder classwork folder "10_15_coordinate".

    Look at the Driver file:

    There are a few questions to respond in that file. Please write your answers as comments in Driver.java

    Optional: If you have time you may start writting the Point class. Otherwise, no worries we will work on this tomorrow, Thursday.

    DO NOT FORGET TO COMMIT AND PUSH YOUR CHANGES AT THE END OF THE PERIOD.

  74. CW 13 - And... More 2D Arrays!


    DUE DATE:

    Starter Code.

    Save your Java files here: .../APCSA1/apcsa-assignments-YourUsername/classwork/10_08_2D_arrays/

  75. CW 12 - 2D Arrays Practice


    DUE DATE:

    Directions are here.

    Save your Java files here: .../APCSA1/apcsa-assignments-YourUsername/classwork/10_07_2D_arrays/

  76. CW 11 - 2D Arrays


    DUE DATE:

    Directions are here.

    Save your Java files here: .../APCSA1/apcsa-assignments-YourUsername/classwork/10_06_2D_arrays/

  77. CW 10 - We love arrays and CodingBat


    DUE DATE:

    CodingBat

  78. CW 09 - Arrays and Loops


    DUE DATE:

    CodingBat

  79. CW 08 - Arrays


    DUE DATE:

    CodingBat

  80. CW 07 - More Strings


    DUE DATE:

    CodingBat

    Java Visualizer

    Important: Make sure to log in to CodingBat before you begin.

    Due Date: Thursday, September 25 at 8:00 am

  81. CW 06 - Strings


    DUE DATE:

    Get this starter code and follow those directions.

    Save your file here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/09_18_strings/MyStrings.java

  82. CW 05 - CodingBat


    DUE DATE:

    Let's work on the following Exercises to strengthen your problem-solving and programming skills.

    Important: Make sure to log in to CodingBat before you begin.

  83. CW 04 - Scanner


    DUE DATE:

    Save your file here: .../APCSA1/apcsa-assignments-fall-YourUsername/classwork/09_15_scanner/NightOut.java

    Follow these directions to write your NightOut.java program:

    You and a friend are going out for the night. You have decided to treat your friend, so you’re paying for the whole night. However, since you have a fixed amount of money to spend on fun things, you need to track how much the outing will cost so you can update your budget.

    Write a program to help yourself estimate what the total cost of the night will be. Your program will estimate the cost by taking the cost of the activities for one person and estimating how much it will cost for two people.

    Here’s what you know about your activities:

    Dinner - you know you typically get cheap dinners, so you expect that your friend’s dinner will be twice as expensive as yours

    Laser Tag - since laser tag is charged per person, you and your friend will cost the same

    Ice cream - you like the triple scoop, but your friend likes a single scoop. Your friend’s ice cream will cost 1/3 as much as yours.

    Your program should ask how much YOUR dinner cost, how much laser tag costs per person, and how much YOUR ice cream costs. It should then compute how much your friend’s costs will be based on the information above. Be sure your program takes the input in this exact order. Then print how much dinner will cost (for both of you), how much laser tag will cost (for both of you), and how much the ice cream will cost (for both of you). Then print the grand total for the evening.

    Your output should look something like this:

    How much does dinner usually cost? 
    
    12.63
    
    How much is laser tag for one person? 
    
    17.50
    
    How much does a triple scoop cost? 
    
    27.00
    
    Dinner: $37.89
    
    Laser Tag: $35.0  
    
    Ice cream: $36.0
    
    Grand Total: $108.89
    

  84. CW 03 - Casting


    DUE DATE:

    Create a java file Casting.java and implement a method that:

    • Receives 2 integers
    • Divides the two ints
    • Prints the result

    The trick here is that we want the division of the two ints to result in a double! Casting values to doubles will be necessary to solve this exercise. Here is an example:

    x = 3
    
    y = 4
    
    Output => 0.75
    

    Save your file here: .../APCSA1/apcsa-assignments-YourUsername/classwork/09_12_casting/Casting.java

  85. CW 02 - Expressions


    DUE DATE:

    Indicate the value and type of each of the following expressions. If the expression does not compile or causes a runtime exception, put an X.

    You do not have to submit this work, but do it on your notebook so you can review it at any time.

    Expressions
    
    2 + 5
    
    8 / 10 * 1.5
    
    12 % 7
    
    2 + 3 * 4
    
    2 + 3.0 * 4
    
    1 / 1 / 0
    
    1.0 / 1 / 0
    
    “Happy” + “Face”
    
    “8+2” + “5”
    
    “10” + 8 + 12
    
    2 + 4 + "5" + 6
     
    27 % 4
    

  86. CW 01 - Hello World and Git


    DUE DATE:

    The objective of this exercise is to create a java file, add it, commit and push to a remote repository.

    1. In your local machine, go to the folder where your assignments repo was cloned ...../APCSA1/apcsa-assignments-fall-YourUsername/, execute git pull and create a folder classwork.

    2. Create a folder 09_09_hello_world inside the classwork folder.

    3. Write a java file HelloWorld.java that prints the message "Hello World!".

    4. Run git status. What does it show?

    5. To add the new file to the repository, run the following command from the root (top-level, ...../APCSA1/apcsa-assignments-fall-YourUsername/) of your repo, not from inside the classwork folder:

      git add classwork/09_09_hello_world/HelloWorld.java

    6. Run git status again. What does it show this time?

    7. Commit and push the file to your repo.

    8. Go to GitHub, HelloWorld.java should be there.