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:
How many classes are there? Are they parent/child classes? If not, what are the relationships among these classes?
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?
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.
Use the examples provided to verify the input, output and functionality of the method
Manually work on the examples to complete the functionality, note down what other info is needed in your manual process
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.
Use the examples provided to verify the input, output and functionality of the method
Manually work on the examples to complete the functionality, note down what other info is needed in your manual process
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.
public boolean simulate(){
FrogSimulation x = new FrogSimulations(goalDistance, maxHops);
if(hopDistance() >= goalDistance)
return true;
else if(hopDistance() < 0)
return false;
else if(maxHops == 5 && hopDistance() != goalDistance)
return false;
}
public double runSimulations(int num){
int false = 0;
double success;
double rV = success/num;
for(int i = 0; i < num; i++){
if(simulate() = true)
success++;
else
return false;
}
return rV;
}