Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1- A program that shows whether a password entered by the user is valid or not is given below. The program continues to run until

image text in transcribed
image text in transcribed
1- A program that shows whether a password entered by the user is valid or not is given below. The program continues to run until the user enters a valid password. The password rules are defined in the code. Complete this program as runnable correctly. (20pts) public class 01 ( public static void main(String[] args) String si Scanner input System.out.print "1. A password must have at least eight characters. " + "2. A password consists of only letters and digits. " + "3. A password must contain at least two digits " + "Input a password: "); ; if > System.out.println("Password is valid: " + s); } else { System.out.println("Not a valid password: " + s); System.out.println("Please try again"); } } while (is_valid_password ( > public static is_Valid Password password) int PASSWORD LENGTH (password. length() PASSWORD LENGTH) return int charCount = 0; int charCount = 0; int numCount = 0; for (int 0; char ch password.charAt( > 1 (is_Numeric numCount++; else (is_Letter )) charCount++; else return > return (charCount >= 2.66 numCount > 2): 1 public static boolean is_Letter ch) ch .toUpperCase (ch); return (ch >= 'A' && ch - 'D' 66 ch 19'); }) 2- Given four overloading method definitions, // Method 1 public static double pow (double ni, double n2) return Math.pow (ni, n2); } // Method 2 public static int pow(int n, int n2){ return (int)Math.pow (nl, n2); } // Method 3 public static double pow (double ni, int n2) return Math.pow(n1, n2)

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions