logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    sfolax6776
    Feb 09, 2019
      ·  Edited: Jan 14, 2020

    Test Prep 5 - Steps to Work On Free Response Questions

    in AP Computer Science A

    Before you start, plan your time wisely. There will be 4 FRQs, each have 2 parts, 8 pieces of code in total. You have 90 minutes, should spend about 20 minutes on each FRQ and leave a good buffer for reviewing and verifying. Here are the steps to work on FRQs:


    A. Read the whole spec thoroughly. Out of the 20 minutes for each FRQ, you should spend at least 10 minutes on reading the specifications and make sure you understand the question completely. You won't be able to write correct code if you don't understand the question correctly. Ask yourself:

    1. How many classes are there? Are they parent/child classes? If not, what are the relationships among these classes?

    2. What are the instance variables, constructors and methods of each class? Which of them are private? are there any static members? if yes, are they private or public?

    3. What does each method do? what is the input? what is the output?

    B. For part (a), do NOT start writing code until step 3.

    1. Use the examples provided to verify the input, output and functionality of the method

    2. Manually work on the examples to complete the functionality, note down what other info is needed in your manual process

    3. Turn the outcome of step B1 above into method header; turn the process in step B2 above into method body (your notes in step B2 may tell you what variables, or method calls you'll use).

    C. For part (b), do NOT start writing code until step 3.

    1. Use the examples provided to verify the input, output and functionality of the method

    2. Manually work on the examples to complete the functionality, note down what other info is needed in your manual process

    3. Turn the outcome of step B1 above into method header; turn the process in step B2 above into method body (your notes in step B2 may tell you what variables, or method calls you'll use).

    E. Example: Q1 of 2018 FRQ

    F. Practice of the Week: Q4 of 2018 FRQ - due midnight PST, 2/11/2019. Please create a file in your personal folder named TP2-2018FRQ4 and save your code there.

    17 comments
    0
    1536466643
    Feb 09, 2019

    1 class

    0
    sanab227
    Feb 09, 2019

    1 class


    0
    2640733933
    Feb 09, 2019

    instance variable:

    goalDistance

    maxHops


    0
    eric.yanjun.huang
    Feb 09, 2019

    One constructor for the FrogSimulation class

    3 instance methods: 2 public and 1 private



    0
    sanab227
    Feb 09, 2019

    1 private 2 public methods. All instance methods


    0
    archit.gpt2012
    Feb 09, 2019

    hopDistance returns an int representing the distance, in inches, that the frog moves when he hops

    0
    ethanhuang12345
    Feb 09, 2019

    runSimulations: Input: Runs (int num) simulations

    Output: Returns proportion(double) of frogs that passed the goal.

    0
    archit.gpt2012
    Feb 09, 2019

    simulate return a boolean. True if frog passes/reaches the goal successfully ( >= ). Else returns false

    0
    koryiskool
    Feb 09, 2019

    hopDistance() - returns frog's hopping distance

    simulate() - returns true if frog reaches goalDistance (instance variable)

    runSimulations() - returns a proportion of successful attempts of frog reaching goal vs unsuccessful

    0
    kchen4000
    Feb 09, 2019

    simulate: input: null

    output: boolean tells you if the distance in the hopdistance reaches the goal in the needed amount of moves


    runSimulate: input: null

    output: percent of simulates that finish the goal.

    kchen4000
    Feb 09, 2019

    public boolean simulate(){

    frogsimulation sim = new frogsimulation(goalDistance, maxHops);

    double Frog_current_position = 0.0;

    boolean Goal_complete = false;

    for(int i;i<sim.maxHops;i++){

    Frog_current_position += hopDistance();

    if(Frog_current_position>=(double)sim.goalDistance){

    Goal_complete = true;

    break;

    }

    if(Frog_current_position<0){

    break;

    }

    }

    return Goal_complete;

    }



    public double runSimulation(int num){

    int runs = 0;

    int complete_runs = 0;

    boolean completion = false;

    for(int i=0;i<num;i++){

    completion = simulate();

    runs++;

    if(completion){

    complete_runs++;

    }

    }

    System.out.println((double)complete_runs/runs);

    }