Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone fix the code by reading comments (in red color) . Thank you. Users Al /AL Ahaed LAB S Due OCT 16,2918 /This progran

Can someone fix the code by reading comments (in red color) . Thank you. image text in transcribed
image text in transcribed
Users Al /AL Ahaed LAB S Due OCT 16,2918 /This progran check whether the input is valid and in the correct format ort java.util.Scr; ublic class SocialSechus ublic static woid maintString argsII) Scanner console new Scanner(System. In) ooLean ssnFlag false: hile (issnFlag) ystea out.printl Enter SS: tring sunstr consote.nextLinet) snFlag verifyssNissnStr)a oolean strFlag false: / Loop to re Stri and Str2 untit Stri is one Char length hile (istrflag) rstes.out.print ("Enter String 1: tring strl conso le.nextline) yste.out.print("Enter String 2: tring str2 conso le.nextlinet) f(stri. Lengtht) 1)4 trFlagtrue else if(stri.length) str2. length)) fiverifySubString(strl, str2)) DO NOTHING t vord public static boolean verifysubString(String strl, String str2) iffstri.contains(str2HC I/ Check for sstr1 contains str2 ystes out.print tn("String str2 is a substring in stri return true: and starts ar position +strl.indexOf (str2)): ystem out.print In("String+str2is not a substring of str1): return falses public static boblean verifySSNIString ssn) f (ssn, length,!. 11 ) // Check for length false f (ssm eharkti)ssn.charatti)'9') Check for digits cont inue; Ise ( ystes. out.println("Input not valid at return fatse: Layd + (i + 1)); else if (i1) if ((ssn.charkt (i). "I' a6 ssn.charAt(i) Y' ) A66 ssn.charkt(i) (ssn.charkt (i) 11 2')) /Check for digit or Alpha ontinue; Lse f ystem.out.print In("Input not valid at+i return false: 1)

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago