Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. GOOD LUCK! Notes: Assume that the classes listed

image text in transcribed

image text in transcribed

image text in transcribed

please answer

Directions: SHOW ALL YOUR WORK. REMEMBER THAT PROGRAM SEGMENTS ARE TO BE WRITTEN IN JAVA. GOOD LUCK! Notes: Assume that the classes listed in the Java Quick Reference have been imported where appropriate. 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 will not receive full credit. This question involves validating a string that is being used as an identifier. You will write the isValid method of the following Authenticate class. public class Authenticate { /** Returns true if the input string has some property and returns false otherwise public static boolean hasProperty (String str) { /* implementation not shown */ } * /** Returns true if the input string passes validation and returns false otherwise, as described in part (a) Precondition: input is not null. */ public static boolean isValid(String input) { /* to be implemented in part (a) */ } There may be variables and methods that are not shown. non verlanning 3-character grouping of the input string is Write the isValid method, which validates an input string and returns a boolean value based on the following conditions. Every non-overlapping 3-character grouping of the input string is verified individually using the helper method has Property If the length of the input string is not divisible by 3, the isValid method returns false, If the input string contains at least two 3-character groupings for which hasProperty returns true, the isvalid method retumstoue . If there are fewer than two 3-character groupings for which hasProperty retums true the isValid method returns false, isValid Return Call to Possible Values Returned by Value isValid hasProperty hasProperty("but") returns true hasProperty("ter") returns false false isValid("butterfly") hasProperty("fly") returns false hasProperty("tur") returns true true isValid("turtle") hasProperty("tle") returns true isValid("bear") false (because the length of "bear" is not divisible by 3) IJVULL nasPROPES false isValid("bear") You must use hasProperty appropriately to receive full credit. Complete the methodsValid. /** Returns true if the input string passes validation and returns false otherwise, as described in part (a) Precondition: input is not null. public static boolean isValid (String input)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

4. Who would lead the group?

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago