Fiveable
💻AP Computer Science A
​

💻AP Computer Science A

FRQ 2 – Class Design
​
Unit 3: Class Creation
​
AP CS A FRQ Types & Units

Each FRQ type tests specific skills taught in particular units. Here's why certain units appear for each question type:

FRQFocusUnitsWhy
FRQ 1Methods and Control Structures1-2Tests method writing, loops, conditionals - foundational programming from Units 1-2
FRQ 2Class Design3Tests class design, constructors, instance variables - all Unit 3 OOP content
FRQ 3Data Analysis with ArrayList4Tests using, analyzing, and manipulating data in an ArrayList - Unit 4 content
FRQ 42D Array4Tests 2D array traversal and manipulation - Unit 4 content

This mapping reflects College Board's exam structure - each FRQ type tests specific skills that are taught in particular units.

Practice FRQ 1 of 201/20

2. The EventTracker class, which you will write, represents an event attendance system. EventTracker objects are created by calls to a constructor with two parameters.

EventTracker objects are created by calls to a constructor with two parameters.

  • The first parameter is a String that represents the name of the event. (Precondition: Assume that this value is not null.)

  • The second parameter is an int that represents the maximum capacity of the event. (Precondition: Assume that this value will be greater than 0.)

enter

The EventTracker class contains an enter method, which processes a group of people attempting to enter the event.

  • The method takes a single int parameter representing the number of people attempting to enter. Assume this value is greater than 0.

  • The method calculates how many people can enter without exceeding the event's capacity.

  • If the number of people attempting to enter is less than or equal to the available space, all of them enter, and the method updates the current attendance.

  • If the number of people attempting to enter exceeds the available space, the attendance is filled to the capacity, and the remaining people are turned away.

  • The method returns an int representing the number of people who were turned away (0 if everyone entered).

Returns the number of people turned away (int)

stats

The EventTracker class contains a stats method, which returns a string summary of the event status.

  • The method takes no parameters.

  • The method returns a String containing the event name, current attendance, and capacity in the format "Name: current/capacity".

  • If the event is at full capacity (current attendance equals capacity), the string " (FULL)" is appended to the end of the status string.

Returns a formatted String representing the event status

Statement

Return Value (blank if no value)

Explanation

EventTracker e = new EventTracker("Gala", 100);

EventTracker e is constructed with name "Gala" and capacity 100. Current attendance is 0.

e.stats();

"Gala: 0/100"

Returns the status. No one has entered yet.

e.enter(80);

0

80 people attempt to enter. There is space for 100. All 80 enter. 0 are turned away. Attendance is now 80.

e.stats();

"Gala: 80/100"

Returns the updated status.

e.enter(30);

10

30 people attempt to enter. There is only space for 20 (100 - 80). 20 enter, filling the event. 10 are turned away. Attendance is now 100.

e.stats();

"Gala: 100/100 (FULL)"

Returns the status. Because attendance equals capacity, " (FULL)" is appended.

e.enter(5);

5

5 people attempt to enter. The event is full. 0 enter. All 5 are turned away.

Write the complete EventTracker class. Your implementation must meet all specifications and conform to the examples shown in the table.

Timed

00:00

Response auto-saves






Pep

essential ap study content awaits..

Features
Testimonials
Testimonials
start studying →
FRQ Directions
Free Response Question Practice

This practice environment simulates the AP AP Computer Science A Free Response Questions section. Here are some guidelines:

  • Read each question carefully before responding. Pay attention to command verbs like "identify," "explain," "analyze," or "evaluate."
  • Use the timer to practice time management. You can pause, restart, or hide the timer as needed.
  • Mark for Review if you want to come back to a question later.
  • Your responses are saved automatically as you type. You can also use the drawing tool for questions that require diagrams or graphs.
  • Use the toolbar for formatting options like bold, italic, subscript, and superscript.
  • Navigate between questions using the Previous and Next buttons at the bottom of the screen.

Tip: Answer all parts of each question. Partial credit is often available, so even if you are unsure, provide what you know.