aidenhuynh / Epic_CSA

MIT License
0 stars 0 forks source link

Aiden Huynh, Period 3 - 2015 FRQ CollegeBoard and PBL #3

Open aidenhuynh opened 4 months ago

aidenhuynh commented 4 months ago

Question 1: Arrays/2D Arrays

While our project does not currently use any 2D arrays, there are several points in which we operate on arrays. We prefer to use ArrayLists most of the time due to their versatility, and an example of this can be seen in the following code block.

@PostMapping("/newCode")
    public ResponseEntity<QrCode> newCode(@RequestBody QrCodeRequest qrCodeRequest) {
        QrCode qrCode = new QrCode();

        List<String> links = qrCodeRequest.getLinks();
        List<Double> frequencys = qrCodeRequest.getFrequencies(); 

        for (int i = 0; i < links.size(); i ++){
            qrCode.addLink(new LinkFreq(links.get(i), frequencys.get(i)));
        }

        repository.save(qrCode);

        return new ResponseEntity<>(qrCode, HttpStatus.OK);
    }

In this example, we use lists to store data being used in our QR Code generator, which takes an input of different URLs and specified frequencies for how often to be redirected to a certain URL. These URLs and frequencies are stored in arrays in our backend and operated on with our key algorithm, newCode() which adds the links with their frequencies to the qrCode generating API.

This differs from the FRQ in that we are not checking for certain conditions while traversing the array, but instead just using them to more conveniently move data.

Question 2: Classes

I don't know how our project could possibly exist without classes, but one example of them being used is in our seating chart, which is not fully implemented yet, but will be used to store a map of where students sit within a classroom.

public class SeatingChart {
    private Map<Integer,Map<Integer, String>> chart;
    private long classId;

    public SeatingChart(Map<Integer,Map<Integer, String>> chart, long classId) {
        this.chart = chart;
        this.classId = classId;
    }

    public Map<Integer,Map<Integer, String>> getChart() {
        return this.chart;
    }

    public long getClassId() {
        return this.classId;
    }

    public void setChart(Map<Integer,Map<Integer, String>> chart) {
        this.chart = chart;
    }

    public void setClassId(long classId) {
        this.classId = classId;
    }
}

This code block shows the SeatingChart class complete with a constructor, setters, and getters, which are all basic components of a class, which can also be seen in the FRQ. The most important takeaways from stuff like this for me is to know when to use public and private, and I've noticed private is used for setting local variables stored only within the object. Also, I learned from this FRQ that constructors in java do not put a return type.

Question 3: Method and Control Structures & 2D Arrays

This question was the most difficult of the 4 for me because it used a very interesting data structure that I had never heard of before, a SparseArray. This is not used anywhere within our project, but the main components of the question, that being using classes and arrays, very much are used in the project. An example of this can be seen in our model for how the seating charts will work.

{
  "chart": {
    "1": {
      "1": "John",
      "2": "Alice"
    },
    "2": {
      "1": "Bob",
      "2": "Eve"
    }
  },
  "classId": 123
}

This code block shows how we intend to navigate and label certain table groups, which will require very similar algorithms such as the one in the FRQ to traverse.

Question 4: Method and Control Structures

This question involved using interfaces and implementing them and overriding their methods. This is used in multiple points in our project, mostly implementing templates from JPA.

public interface ClassPeriodJpaRepository extends JpaRepository<ClassPeriod, Long> {
    ClassPeriod findByName(String name);

    List<ClassPeriod> findAllByOrderByNameAsc();

    // JPA query, findBy does JPA magic with "Name", "Containing", "Or", "Email", "IgnoreCase"
    List<ClassPeriod> findByNameContainingIgnoreCase(String name);

    List<ClassPeriod> findByLeadersContaining(Person leader);
    List<ClassPeriod> findByStudentsContaining(Person student);
}

This code example for storing class periods extends the basic JPA repository, allowing the ClassPeriodJpaRepository template to inherit useful methods from JpaRepository, while also adding on its own methods.

This FRQ was very helpful to complete for me, as I hadn't really tried to make my own interface before and also I got to work with inheritance which is always fun.

Overall

Most of this will be restating certain points I made on each individual reflection on my FRQs, but here is a comprehensive reflection on all of the FRQs in one spot:

Highlights:

Future Plans:

VINERAJ commented 4 months ago

Code grading

FRQ 1

Part A: After pulling and running it, the output is correct. We solved it in essentially the same way. Since this is an easy part of an easy FRQ question, this is to be expected. Part B: After pulling and running it, the output is correct. There are a few differences in the way we each solved this part, but both solutions are valid. Your use of another method to turn the array into a string shows how deeply you understand the concept of arrays in Java. Part C: After pulling and running it, the output is correct. We have a few differences in our solutions. Your use of nested for loops shows a mastery of that concept. Overall: As you said, this was a pretty easy question, and you did well on it. Therefore, this FRQ earns a 0.90/0.9.

FRQ 2

When pulling and running your code, the output is correct. I like how you went above and beyond and added a check to make sure that the user's guess is the same length of the secret word. Especially because of this, you will earn a 1.1/0.9 on this FRQ.

FRQ 3

Part A: When pulling and running your code, the output is correct. Your code shows that you have a good understanding of arrays. Part B: When pulling and running your code, the output is correct. Your code shows that you have a good understanding of arrays and how to work with them. Overall: Good job on this FRQ. I'd give you a 0.9/0.9 for this FRQ

FRQ 4

Part A: When pulling and running your code, the output is correct. You showed that you had an understanding of interfaces, and although it may not be on the AP exam this year, it is still valuable to know. Part B: When pulling and running your code, the output is correct. You showed that you knew how to use inheritance, and how to override methods. Part C: When pulling and running your code, the output is correct. You showed that you knew how to work with for loops and classes very well. Overall: Good job. I'd give this FRQ a 0.9/0.9

Total: 0.95+1.1+0.9+0.9 = 3.80/3.6

Reflection grading

I like all your associations between the FRQs and your project. The associations, along with your explanations of your code, show that you're thinking deeply about how you can use the FRQ to further your knowledge in Java, and better your project in the future. I also liked how you noted your shortcomings while taking the FRQ test, and you you can improve in the future. I think that one thing you could do to improve is continue to work on this FRQ and others like it.

For the Reflection component, I'll give you a 3.6/3.6

aidenhuynh commented 4 months ago

Crossover Reviews Reflection

Grading

Learning

Future Plans