EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
Question
Book Icon
Chapter 7, Problem 4PE
Program Plan Intro

Program to display valid and invalid password

Program plan:

Filename: “ValidatePassword.java”

  • Define the “ValidatePassword” class
    • Declare the required variables and set the values.
    • Create an object for scanner class.
    • Prompt the user to enter the password.
    • Read the length of the string and store it in a variable.
    • Using, if…else condition check whether the string contains two uppercase, 3 lowercase and one digit.
    • If the condition is satisfied, print the string as valid password, else print as invalid password.

Blurred answer
Students have asked these similar questions
Write an application that allows a user to enter any number of student test scores until the user enters 999. If the score entered is less than 0 or more than 100, display an appropriate message and do not use the score. After all the scores have been entered, display the number of scores entered, the highest score, the lowest score, and the arithmetic average. Save the file as TestScoreStatistics.cpp.
Write an application that determines whether the first two files are located in the same folder as the third one. If the files are in the same folder display All files are in the same folder, otherwise display Files are not in the same folder. Test the program when the files are in the same folder and when they are not. import java.nio.file.*; import java.io.IOException; public class CompareFolders {     public static void main(String[] args) {         Path file1 = Paths.get("/root/sandbox/TestData1.txt");         Path file2 = Paths.get("/root/sandbox/TestData2.txt");         Path file3 = Paths.get("/root/sandbox/test/TestData3.txt");         // Write your code here     } }
Which of the methods below is a correct implementation of the functionality described in this Javadoc comment? /** * This method returns a value that is twice as large as the provided * integer argument. * * @throws IllegalArgumentException if the provided number is negative. */   Group of answer choices public int increase1(int number) throws IllegalArgumentException { return number * 2; }   public int increase(int number) { try { if (number < 0) { throw new IllegalArgumentException(); } else { return number * 2; } } catch (IllegalArgumentException e) { System.out.println("Negative number!"); } }   public int increase(int number) { if (number < 0) { throw new IllegalArgumentException(); } return number * 2; } public int increase(int number) { if (number >= 0) { return number * 2; } else { return IllegalArgumentException; } }
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage