Rankings for the password provided by the user

Assignment Help Basic Computer Science
Reference no: EM132161809

As a developing software need to require enter own password as a following criteria:

a). The program should display one of three rankings for the password provided by the user:

INVALID, ACCEPTABLE, STRONG.

b). The password is ACCEPTABLE if it meets the following criteria, INVALID if it does not:

  • At least six (6) characters in length.
  • Contains at least one (1) uppercase letter and one (1) lowercase letter.
  • Contains at least one (1) numerical digit.
  • Contains at least one of the following special characters: ! @ # $ % ^ & * . ?
  •  (hint: Need to create the array to hold these characters)

c). If the password is INVALID, your program should display the reason(s) why.

  • the password "Tasbih15" is invalid because it is missing a special character.
  • the password "b@buza" is invalid because it is missing an uppercase letter AND a numerical digit.
  • Missing any requirements, please list missing item(s).

d). The password is STRONG if it is at least 10 characters in length and contains at least two (2) special characters.

## Here is my code:

import javax.swing.JOptionPane;

public class AktaruzzamanPasswordVerifier {

   public static void main(String[] args) {

   String input;

   char[] array;

   // Get the user to enter a password to use

   input = JOptionPane.showInputDialog("Enter " +

    "the password that is at least 6 characters long,n " +

    "contains at least 1 uppercase letter, containsn " +

    "at least 1 lowercase letter, and containsn " +

    "and at least 1 digit.");

   // Validate the input.

   if (isValid(input))

   {

   JOptionPane.showMessageDialog(null,

    "This is a valid password.");

   }

   else

   {

   JOptionPane.showMessageDialog(null,

    "That is not the proper format of a " +

    "password.nHere is an" +

    "example: taS5by");

   // user to re-enter a password to use

   input = JOptionPane.showInputDialog("Enter " +

    "The password that is at least 6 characters long,n " +

    "contains at least 1 uppercase letter, containsn " +

    "at least 1 lowercase letter, and containsn " +

    "and at least 1 digit.");

   }

   System.exit(0);

  }

   private static boolean isValid(String userPassword)

   {

    boolean goodSoFar = true

   int i = 0;    

   // Test the password length.

   if (userPassword.length() < 6)

    goodSoFar = false;

   JOptionPane.showMessageDialog(null, "Password invalid. Must contain at least 6 characters");

   // Test the password at least 1 upper case letter

   while(goodSoFar)

   {

    if (!Character.isUpperCase(userPassword.charAt(i)))

    goodSoFar = false;

    System.out.println("No uppercase");

    i++;

   }

   // Test the password at least 1 lower case letter

   while(goodSoFar)

   {

    i = 0;

    if (!Character.isLowerCase(userPassword.charAt(i)))

    goodSoFar = false;

    System.out.println("No lowercase");

    i++

   }

   // Test the password at least 1 numeric digit letter

   while(goodSoFar)

   {

    i = 0;

    if (!Character.isDigit(userPassword.charAt(i)))

    goodSoFar = false;

    System.out.println("No numeric");

    i++;

   }

   return goodSoFar;

   }

   }

Reference no: EM132161809

Questions Cloud

Examine the nursing theory components : Examine the nursing theory's components. Create plan for evaluating the effectiveness of care provided using this nursing theory.
Binary operator appears between the operands : Mathematical formulas are usually expressed in what is known as infix notation, in which a binary operator appears between the operands.
Computing an internal price index : Computing an internal price index and using the dollar-value LIFO method, at what amount should the inventory be reported at December 31, 2018
What is the expected value of the survey information : What is the expected value of the survey(sample) information?
Rankings for the password provided by the user : a). The program should display one of three rankings for the password provided by the user:
What clinical problem or issue the organization is facing : During your practicum, determine what clinical problem or issue the organization is facing. Discuss two implications for nursing.
What is the main issue for your organization : What is the main issue for your organization in addressing a solution to evidence-based nursing practice? Discuss what might be the first step in addressing.
Differing opinions of union vs nonunion perspectives : Based on the laws of the US, and the differing opinions of union vs nonunion perspectives, how should an HR Manager approach employee efforts to unionize?
What is communication and mention two types : What is communication and mention two types? Explain five advantages of technology in business world?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Will that make any difference in the recovery process

Will that make any difference in the recovery process?

  The vendor about the increased storage

A company that has engaged in a business that requires fast response times has just recieved a bid for a new system that includes much more storage thatn was specified in the requirements document. When the company questioned the vendor about the inc..

  Identify and research three different commercial it security

Security being a top concern for any organisation, choosing the correct security solutions is of utmost importance. Consider an area of information technology (IT) security, such as, network security, e-mail security, database security and so on. Ide..

  Period of extremely low inflation and extremely low

In the late 1990's, the U.S. economy experienced a period of extremely low inflation and extremely low unemployment.

  Write a function called class average

Write a function called class Average that takes in an array of numbers and, after normalizing the grades in such a way that the highest corresponds to 100, returns the letter grade of the class average.

  Difference between accounting and economic profit

Explain the difference between accounting and economic profit. Give 2 examples of when they differ.

  Change their passwords often enough

1. Front desk staff is giving out too much in- formation over the telephone 2. The room holding the network servers is unlocked

  How can you encourage employees to think

How can you encourage employees to think, challenge, and collaborate? Provide at least three suggestions.

  Is curve and the lm curve

please draw the changes in the IS Curve and the LM Curve if there are any.

  Bottleneck effect on an organization operations

A biometric system must be able to analyze the sample data and perform a database lookup extremely efficiently to avoid issues that will produce a bottleneck

  Treasury bill for the 180-day period

The price of a 180-day Treasury bill is quoted as 10.50. What continuously compounded return (on an actual/365 basis) does an investor

  Learned about technical communication

Discuss what you have learned about technical communication during this course. Address the following areas in your post:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd