Skip to the content.

FRQ 2025 Q2 - Rohan Bojja

FRQ 2025 Q2 Screenshot

Problem Approach

  • Created a class to store a person’s first and last name as private instance variables.
  • Used a constructor to initialize the name values when a SignedText object is created.
  • Built a getSignature() method to generate a signature using:
    • The first letter of the first name (if it exists)
    • A dash
    • The full last name
  • Used indexOf() to check whether the signature already exists in the text.
  • Handled three cases in addSignature():
    • Signature not found → append it to the end of the text
    • Signature found at the beginning → move it to the end
    • Signature found elsewhere → leave the text unchanged
  • Returned the modified (or unmodified) text based on these conditions.