Free-Response Question 1: Methods and Control Structures. Students will write two methods or one constructor and one method of a given class based on the provided specifications and examples. In Part A (4 points), the method or constructor will require students to write iterative or conditional statements, or both, as well as statements that call methods in the specified class.
There are other methods in the String class that may also be helpful while writing FRQs, but it is important to remember that all FRQs can be solved using just the methods in the Quick Reference. If you use a method that is not on the Quick Reference, you must use it correctly to earn points.
The getDomain method takes one parameter, a String called email. The method should identify the location of the "at-symbol" (@) and return only the portion of the string that appears after that symbol.
Write a method called getAreaCode that extracts the 3-digit area code from a formatted phone number. The area code will be the three digits between the parentheses.
Write a method called isVowel that checks if a given String represents a single vowel. If the letter does not have a length of 1, the method should return false.
This class creates a username by taking the first letter of the first name and the first five letters of the last name. It uses an if statement to handle cases where the last name is shorter than five characters.
A common task is extracting text between two delimiters (like HTML tags). Uses indexOf to find the start and end and substring to grab whatβs in the middle. Return "not found" if the the tags are not found, not balanced, or backwards
This class takes a two-word string (separated by a space) and returns a new string where the words are swapped. Use indexOf to find the pivot point and length() to ensure there is actually a second word.