Write the complete CombinationLock class, including any required instance variables, its constructor, and the method getClue,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the complete CombinationLock class, including any required instance variables, its constructor, and the method getClue, described Activate W Call to getClue String returned "++0+" comboLock.getClue ("0000") comboLock.getClue ("flip") comboLock.getClue ("form") "f***" "f++*" comboLock.getClue ("frag") "fr*g" comboLock.getClue ("frog") "frog" CodeHS AP Java FRQ: Combination Lock Game Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN Java. Notes: Assume that the classes listed in the Quick Reference have been imported where needed. Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods may not receive full credit. Consider a game with a combination lock box that has a 4-letter word as the combination. A player tries to guess the combination by guessing one letter at a time to win a prize inside the box. The combination only contains 4 lower-case letters and a guess can only contain 4 lower-case letters. For each round of play, the player is given a clue based on a comparison between the combination lock and the guess. Each position in the clue contains a character that corresponds to the letter in the same position in the guess. The following rules determine the characters that appear in the clue. If the letter in the guess is... the corresponding character in the clue is also in the same position in the combination lock. the matching letter also in the combination lock, not in the combination lock, "+" 1111 The CombinationLock class will be used to represent the combination lock in the game. The combination lock is passed to the constructor. The class contains a method, getClue, that takes a guess and produces a clue. For example, suppose the variable comboLock is declared as follows: CombinationLock comboLock = new CombinationLock("frog"); The following table shows several guesses and hints that would be produced. Write the complete CombinationLock class, including any required instance variables, its constructor, and the method getClue, described Activate W Call to getClue String returned "++0+" comboLock.getClue ("0000") comboLock.getClue ("flip") comboLock.getClue ("form") "f***" "f++*" comboLock.getClue ("frag") "fr*g" comboLock.getClue ("frog") "frog" CodeHS AP Java FRQ: Combination Lock Game Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN Java. Notes: Assume that the classes listed in the Quick Reference have been imported where needed. Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied. In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods may not receive full credit. Consider a game with a combination lock box that has a 4-letter word as the combination. A player tries to guess the combination by guessing one letter at a time to win a prize inside the box. The combination only contains 4 lower-case letters and a guess can only contain 4 lower-case letters. For each round of play, the player is given a clue based on a comparison between the combination lock and the guess. Each position in the clue contains a character that corresponds to the letter in the same position in the guess. The following rules determine the characters that appear in the clue. If the letter in the guess is... the corresponding character in the clue is also in the same position in the combination lock. the matching letter also in the combination lock, not in the combination lock, "+" 1111 The CombinationLock class will be used to represent the combination lock in the game. The combination lock is passed to the constructor. The class contains a method, getClue, that takes a guess and produces a clue. For example, suppose the variable comboLock is declared as follows: CombinationLock comboLock = new CombinationLock("frog"); The following table shows several guesses and hints that would be produced.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
The values explicitly used in the initialization are used. However, if there is at least one constructor defined in the class other than the no-argument constructor which is absent, Java will treat...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
A chef in a restaurant that specializes in pasta dishes was experiencing difficulty in getting brands of pasta to be al dente-that is, cooked enough so as not to feel starchy or hard but still feel...
-
Sketch the area represented by g(x). Then find g'(x) in two ways: (a) By using Part 1 of the Fundamental Theorem (b) By evaluating the integral using Part 2 and then differentiating. g(x) = * dt
-
A fund manager wants to hedge the exposure of her US equity portfolio using futures contracts on the S&P 500. Her portfolio has a value of 10 million USD and a beta of 1.4. The S&P 500 futures is...
-
The "wye" fitting shown in Fig. P.3.110 lies in a horizontal plane. The fitting splits the inlet flow into two equal parts. At section 1 , the water velocity is \(12 \mathrm{ft} / \mathrm{sec}\) and...
-
A firms long-run total cost function is C = 360 + 40Q + 10Q2. a. What is the shape of the long-run average cost curve? b. Find the output that minimizes average cost. c. The firm faces the fixed...
-
Swifty Painting Company has the following production data for March. End. Work in Process Inv. % Complete as to Conversion Cost Month Beg. Work in Process Inv. Units Completed and Transferred Out...
-
Mother Nature Supplies Following are selected data from the financial statements ofMother Nature Supplies: 2017 2016 Accounts receivable $ 60,000 $38,000 Merchandise inventory 12,000 16,000 Total...
-
The following data relate to the operations of Shilow Company, a wholesale distributor of consumer goods: a . The gross margin is 2 5 % of sales. b . Actual and budgeted sales data: c . Sales are 6 0...
-
The Cayunda Company started operations in 2023. The following data are abstracted from the company's production and sales records: 2022 Number of units produced 270,000 2023 265,500 2024 222,500...
-
the questions below and provide the FAR citation in accordance with the guidance provided at FAR 1.105-2 1. Discuss some of the best practices in conducting market research, both in the Federal...
-
Grand Corporation reported pretax book income of $ 6 6 3 , 0 0 0 . Tax depreciation exceeded book depreciation by $ 4 4 2 , 0 0 0 . In addition, the company received $ 3 3 1 , 5 0 0 of tax - exempt...
-
Sources of Magnetic Field 1. Estimate the maximum magnetic force per meter that Earth's magnetic field could exert on a current-carrying wire in a 20-A circuit in your house. 2. A straight segment of...
-
Write an essay on how does Judaism continue to influence the modern world? Give examples.
-
The activities listed in lines 2125 serve primarily as examples of A) Underappreciated dangers B) Intolerable risks C) Medical priorities D) Policy failures
-
Two European call options with a strike price of \($50\) are written on two different stocks. Suppose that tomorrow, the low-volatility stock will have a price of \($50\) for certain. The...
-
Which feature best describes a PERT chart? a. It creates a time line of production tasks. b. It creates a work flow for production equipment. c. It identifies the critical path of tasks in a project....
-
\(50 \mathrm{~m}^{3}\) of air at \(18^{\circ} \mathrm{C}\) DBT and \(12^{\circ} \mathrm{C}\) WBT are mixed with \(20 \mathrm{~m}^{3}\) of dry air at \(32^{\circ} \mathrm{C}\) DBT and \(24^{\circ}...
Study smarter with the SolutionInn App