Open Jw95z opened 7 months ago
Note: We demonstrated running code in notebooks to verify functionality
FRQ # | Comments | Score |
---|---|---|
1 | Code runs as expected and FRQ type correctly identified | 0.9/0.9 |
2 | Code runs as expected, type is Methods and Control Structures | 0.9/0.9 |
3 | Code runs as expected and FRQ type correctly identified | 0.9/0.9 |
4 | Code runs as expected, FRQ type correctly identified, and additional code for clarity in output | 0.9/0.9 |
Overall | Combined score for 1.1 scale FRQs | 3.6/3.6 |
I think that your reflection is very insightful and clearly shows the learning you have gained from doing the FRQs. The fact that you had most of the elements from the FRQs in your project is also a great demonstrator of the power of PBL as an educational method. What I liked the most is the detail of how each code that connected with the FRQ in your project was described. This showed that you spent time and did the FRQ rather than just using AI. One thing that could have been done better is Explain the FRQ question and its association directly. You have asscociated the major theme but if you added one sentence on how the methods in the FRQ code and project code are similar or different it would have let a better association to be made.
Overall, I would give you a 3.6/3.6 for your FRQ Association.
Frq
Frq 1 (Array & 2D Array)
I created a method to get stock statistics for users in a Spring application. First, I retrieve all users from the repository. Then, I initialize a HashMap called "data" to store the aggregated statistics. For each user, I check their statistics for a specific date (02-15-24). If the statistics exist for that date, I iterate over a list of stock symbols.
@GetMapping("/stockStats") public ResponseEntity<Map<String, Integer>> getStockStats() { List users = repository.findAll();
HashMap<String, Integer> data = new HashMap<>();
This code fetches stock statistics for a specific date from a list of users. It uses an array of stock symbols, like "AAPL" for Apple or "AMZN" for Amazon, to iterate through each user's stats for that date. For each user, it checks if there are statistics available for that stock. If so, it adds up the stock values for each symbol across all users. If the value is an integer, it adds it directly, but if it's a string, it first tries to convert it to an integer. Finally, it returns a map containing the total stock values for each symbol
Frq 2 (Classes)
I've created a Java class named UploadFile within a Spring Boot application. This class serves to capture details about uploaded files, specifically images. Additionally, I've constructed a parameterized constructor for the UploadFile class, taking username and ImageEncoder as arguments. This constructor initializes the corresponding attributes of the UploadFile object. To streamline the class, I've utilized Lombok annotations, namely @Data, @AllArgsConstructor, and @NoArgsConstructor, to automatically generate getters, setters, and constructors, thereby reducing redundant code. In essence, the UploadFile class provides a structured representation for managing uploaded files within the Spring Boot application environment.
package com.nighthawk.spring_portfolio.mvc.profile;
import java.time.LocalDateTime; import java.util.Date;
import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id;
import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor;
@Entity @Data @AllArgsConstructor @NoArgsConstructor public class UploadFile {
}
Frq 3 (Arraylists)
I defined some data structures to store information in a Spring application. I made a collection called "roles," which is used to store the roles of a person. Each person can have multiple roles, and you're using a ManyToMany relationship, which means a person can have many roles, and a role can belong to many people. Then, I created a map called "stats" to store user statistics. I also have another collection called "classCodes," which is used to store class codes associated with something else in your application. I used a OneToMany relationship here, indicating that one thing can have many class codes. In this Java code, I created a method to load user details by their email address for a Spring Security application. I created a list called authorities to store the roles of the person. I make a loop through each role of the person, creating a SimpleGrantedAuthority for each role, and add it to the authorities list. After that, I add a custom authority based on the user's ID to the authorities list. Finally, I create and return a UserDetails object containing the person's email, password, and authorities.
Frq 4 (Interfaces)
In my project, I used an interface to abstract the JPA repository for accessing roles. The Java code features an interface named PersonRoleJpaRepository that extends the JpaRepository interface from Spring Data JPA, aligning with the abstraction concept commonly assessed in Advanced Placement Computer Science A (AP CSA) exams. The interface declares a method, findByName, representing a standardized query for retrieving a PersonRole by its name. Interfaces provide a contract without specifying implementation details, allowing concrete classes to adhere to the defined structure. This example illustrates the practical application of interfaces in Spring Data JPA, emphasizing their role in code organization and abstraction, concepts frequently examined in AP CSA questions.