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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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