Eric FRQ Showing 2 - yajatyadav/intellijs GitHub Wiki
Unit 10 Recursion Searching (Sorting)
Link: https://replit.com/@elw55555/Unit10Q1-Recursion-Searching-Sorting
Reflection: This unit, I used recursion to make a call to an algorithm that finds the gcf of two numbers to simply fractions.
-
I applied mathematical knowledge that to simplify a fraction, we divide the numerator and the denominator by their gcf. A main method was then used to make a call to the method reduceFraction to reduce a set of fractions to print them out.
-
A set of if-else statements were made so that if the denominator was greater than 1, it would produce a fraction. If the denominator was one or less, it would use division and return a whole number.
Unit 9 Inheritance (Overrides, References, Constructors)
Link: https://replit.com/@elw55555/Unit9Q1-Inheritance-Overrides-References-Constructors
https://replit.com/@elw55555/Unit9Q2-Inheritance-Overrides-References-Constructors
Reflection: In this unit, both FRQs involved using the keyword "extends" to create child classes that can reference variables multiple times.
- Scanners were implemented in order to acquire an input of the book name, author, illustrator, and price.
- Parametrized and base constructors were used to set up info about the books in Book.java, BookListing.java, and PictureBook.java.
- Found out that when I extend classes using "extends," I must create the files in order. For example, I had the class Herbivore extends Animal, and then the class Elephant extends Herbivore. However, when I made the Elephant file first, and then I tried to extend Herbivore to it and then Extend Animal to Herbivore, it did not work. I copy-pasted all the code and created the files with the classes of Animal, Herbivore, and Elephant and it worked.
- This applied the previous unit's ideas where I implemented the subclasses' methods to print different messages.
- What I found interesting was a bug when using scanners with Doubles where it would mess up the next scanner, but String would not.
Unit 8 2D Arrays
Link: https://replit.com/@elw55555/Unit8Q1-2D-Arrays
Reflection: This FRQ focused on using for-loops to traverse and manage 2D arrays.
- The focus of 2D arrays as a program to be implemented with a farm plot with grids to measure the crop yields really helped my understanding of 2D arrays on how to index all the rows and columns and access data in it.
- Helped learn the concept of using for loops inside for loops for determining the maxyield.
- Applied previous unit concepts of boolean statements.
- Applied knowledge of creating classes in initializing all the variables in the Plot.java file.
Unit 7 Arraylists
Link: https://replit.com/@elw55555/Unit7Q1-Arraylists
Reflection: This unit I focused on distinguishing arraylists from arrays and traversing them to recognize the differences.
- Used for loops traverse through the arraylists to apply the same change to all of the items in the arraylist.
- Used the if and else statements to check the possibleNames and compare values.
Unit 6 Arrays
Link: https://replit.com/@elw55555/Unit6Q1-Arrays
https://replit.com/@elw55555/Unit6Q2-Arrays
Reflection: This used arrays for assigning the different words for the first question and then different wages for different employees for the second question.
- Used for loops to go through the list and check the last free characters and add "ing."
- Used for loops for the second part to firstly find the total bonus wage through an average.
- Found the cutoff for the bonus wage and then used if statements to see each employee's wage and then apply the bonus wage if they met the threshold then find each employee's final wage.
Unit 5 Writing Classes
Link: https://replit.com/@elw55555/Unit5Q1-Writing-Classes
https://replit.com/@elw55555/Unit5Q2-Writing-Classes
Reflection: The FRQ composed of knowing how to declare a class, initiate variables through a constructor, and then implement methods.
- Question 1 was creating a simple class for a host name and address, where a base constructor and an overloaded constructor were used and then return strings based on information.
- Question 2 was creating a password generator. I used a separate main method to declare the prefix, determine how many random numbers generated, and finally to print out the randomly generator passwords.
- In this question, in the second PasswordGenerator class file, I declared variables with constructors and overloaded and used the keyword "this." to refer to the variables.
- I used a for loops to assign random values with random.nextInt to generate random integers for the suffix to finalize the full password generated.
- Finally, to incremenet the count by 1 every single time a password was generated at the end, I was used the "this." keyword again to add 1 to the total password count to be printed in the Main method.
Unit 4 Iteration
Link: https://replit.com/@elw55555/Unit4Q1-Iteration
Reflection: This unit focused on for loops which proved to be extremely important, especially with arrays, arraylists, and 2D arrays.
- In question 1, I used for loops to specify conditions for identifying the most common letter and then finding how many there are.
- In question 2, for loops were made to implement each specific rule in the game. Firstly to implement what action is done every single round, find how much is spent, and to implement win conditions with if statements until the maxrounds was reached.
- Player moves were determined through specific conditions in the FRQ question and use compound boolean expressions to check criteria for the rules.
Unit 3 Boolean Statements and If Statements
Link: https://replit.com/@elw55555/Unit3Q1-Boolean-Statements-and-If-Statements
Reflection: This frq focused on the mastery of if/else statements to see if someone was attending and what they will be served.
-
Scanners were used, first a boolean to find rsvp and then another one to determine their food dish from a number selection based on criteria from the FRQ.
-
Concatenated different data types to form a data using string literals and variables.
-
For the second FRQ (implemented in PBL), I worked with my team to create method to draw the square. We had to use math to use constants and variables to center the coordinates from the origin instead of having it appear in the wrong places.
-
Used compound boolean expressions to deal with restrictions of the case of the user inputting coordinates too large for the grid.
public static void drawSquare(int x, int y, int len){
if (x + len >10 && y -len < 0) {
len = Math.min(10-x, y);
}
else if (x + len >10){
len = 10-x;
}
else if (y - len < 0) {
len = y;
}
drawLine(x, y, x+len, y);
drawLine(x, y, x, y-len);
drawLine(x, y-len, x+len, y-len);
drawLine(x+len, y-len, x+len, y);
int area = len * len;
System.out.println(String.format("Side length = %d, area = %d", len, area));
}
Unit 2 Objects and Instances of Objects
Link: https://replit.com/@elw55555/Unit2Q1-Objects-and-Instances-of-Objects
Reflection: This FRQ focused mostly on manipulating strings and inserting and removing specific segments with specific questions.
- Used math class methods to calculate for example the square root of a and b to calculate the distance from the lightbulbs from the distance formula.
- Applied Unit 5 work to create classes with the constructor in order to execute the code instead of having it saved from just one question after another without running code.