Hey all, if you could create a java program following these guidelines that would be much appreciated. helpful comments in the program would be appreciated :)
The idea of this program is as followes :
A password must meet special requirements, for instance , it has to be of
specific length, contains at least 2 capital letters , 2 lowercase letters,
2 symbols and 2 digits. A customer is hiring you to create a class that
can be utilized for several clients of the customer.
The first object created will be for the first level clients which requires
a moderate level password which contains ( at least 1 capital letters ,
1 lowercase letters,1 symbol and 1 digit).
The first level should be created using a default constructor.
The length of any password should be at least 8 characters for all levels.
Hint, should be static.
The second object created will be for the second level clients which requires
a harder level password which contains ( at least 2 capital letters ,
2 lowercase letters,2 symbol and 2 digits).
The second level should be created using an overloaded constructor.
the length of the second level password should be at least 8 as it
required for any levels.
*/
import java.util.Scanner;
public class Password{
/*(1 point) Create a private static default password variable and set
it to Def@u1tPa$$w0rd which meets the standards of accepted password*/
//(1 point) Create a private static int length of the password and set to 8.
// Private settings that should be met for each password instance/objects
//(1 point) Create a private variable to store the number of symbols
//(1 point) Create a private variable to store the number of capital letters
//(1 point) Create a private variable to store the number of lower case letters
//(1 point) Create a private variable to store the number of digits
// (1 point)Create a private variable to store the password
/** (3 points) Create the default constructor,
* call the overloaded constructor(next method)
* to set the default required number
* for capital,lowercase letters, symbols and digits to 1,
* set the password variable to the default password
*/
Password()
{ // default values
// call the overloaded constructor providing the default settings.
}
/**( 6 points) Create an overloaded constructor ,that takes
* number of ( symbols , capital letters, small letters, digits)
* these will be considered settings for initializing an instance of
* the password, set the global private variables (also known as data fields)
* to the passed in arguments
*/
Password ( int numSymbols, int numCap, int numSmall, int numDigits )
{
}
/**(3 points) Create a method that takes a string password and check if
* it is equal to the length specified then return true, false otherwise */
public boolean validLength(String pass)
{
}
/**(10 points) Create a method that takes a string password ,
* the method checks if the password has at least the
* required number of symbols and return true, false otherwise
// Declare a counter variable
// Declare a boolean to hold the answer
// Loop through the length of the password
// Once you counted the required number, set answer to true and break
// Using the Ascii table, check each index if in the range [32 -47] or
[58-64]
// if a symbol, increment the count
// return the answer
*/
/**( 2 points) Create a method that takes a string password ,
* the method checks if the password has at least the
* required number of digits and return true, false otherwise
* the style of this method will be similar to the previous method
* use the range in the Ascii table [48 -57] for digits
*/
/**( 2 points)Create a method that takes a string password ,
* the method checks if the password has at least the
* required number of capital letters and return true, false otherwise
* the style of this method will be similar to the previous method
* use the range in the Ascii table [65 -90] for capital letters
*/
/** ( 2 points) Create a method that takes a string password ,
* the method checks if the password has at least the
* required number of lowercase letters and return true, false otherwise
* the style of this method will be similar to the previous method
* use the range in the Ascii table [97 -122] for lowercase letters
*/
/**(2 points) create a getter method to return the password*/
/** ( 15 points) Create a setter method to set the password*/
public void setPassword( )
{
// Declare a String to hold a password
// Declare a scanner object to receive a password from the keyboard
// Declare a boolean variable and set it to true
// Which assumes the password meets the settings.
// Loop until the user provides a correct password
// prompt the user to enter the password ,
// specify the requirements based in the settings
// scan the next line and store in the String holding the password
/* If the password provided is not equal to the length required,
then print out an error message*/
/* If the password doesn't have the required number of capital letters
then print out a message*/
/* If the password doesn't have the required number of lowercase letters
then print out a message*/
/* If the password doesn't have the required number of symbols
then print out a message*/
/* If the password doesn't have the required number of digits
then print out a message*/
/* if the password meets all of the settings,
then password provided is valid
set the global variable password to the new qualified password
set the flag to false, to stop iterations
*/
}
/**
* (8 points)create the main method
*/
public static void main(String[] args) {
//Declare an instance of Password using the default constructor
// print out the password, using the getter method
// What is the default password ?..................
// Use the setter method to set a password
// Print out the password using the getter method
/*Declare an instance of the password using the overloaded constructor,
the settings for new password object are:
(2 Captial letters,2 Lowercase letters, 2 Symbols , 2 Numbers)*/
// Set the password using the setter method.
// Print out the password using the getter method
}
}
The code follows each and every instruction given in the comments. The output is also in accord with the instructions for the main() method.
# If you have a query/issue with respect to the answer, please drop a comment. I will surely try to address your query ASAP and resolve the issue
# # Please consider providing a thumbs up to this question if it helps you. by doing that, you will help other students who are facing a similar issue.
//------------------OUTPUT/INPUT--------------------

//------------------------------------------------------------------------------
import java.util.Scanner;
public class Password {
/*
* (1 point) Create a private static default password variable and set it to
* Def@u1tPa$$w0rd which meets the standards of accepted password
*/
private static String deafaultPassword = "Def@u1tPa$$w0rd";
// (1 point) Create a private static int length of the password and set to 8.
private static int length = 8;
// Private settings that should be met for each password instance/objects
// (1 point) Create a private variable to store the number of symbols
private int numSymbols;
// (1 point) Create a private variable to store the number of capital letters
private int numCap;
// (1 point) Create a private variable to store the number of lower case letters
private int numSmall;
// (1 point) Create a private variable to store the number of digits
private int numDigits;
// (1 point)Create a private variable to store the password
private String password;
/**
* (3 points) Create the default constructor, call the overloaded
* constructor(next method) to set the default required number for
* capital,lowercase letters, symbols and digits to 1, set the password variable
* to the default password
*/
Password() {
// default values
// call the overloaded constructor providing the default settings.
this(1, 1, 1, 1);
this.password = deafaultPassword;
}
/**
* ( 6 points) Create an overloaded constructor ,that takes number of ( symbols
* , capital letters, small letters, digits) these will be considered settings
* for initializing an instance of the password, set the global private
* variables (also known as data fields) to the passed in arguments
*/
Password(int numSymbols, int numCap, int numSmall, int numDigits) {
this.numCap = numCap;
this.numSymbols = numSymbols;
this.numSmall = numSmall;
this.numDigits = numDigits;
}
/**
* (3 points) Create a method that takes a string password and check if it is
* equal to the length specified then return true, false otherwise
*/
public boolean validLength(String pass) {
if (pass.length() == length) {
return true;
}
return false;
}
/**
* (10 points) Create a method that takes a string password , the method checks
* if the password has at least the required number of symbols and return true,
* false otherwise
*
*
* // Declare a counter variable
*
* // Declare a boolean to hold the answer
*
* // Loop through the length of the password
*
* // Once you counted the required number, set answer to true and break
*
* // Using the Ascii table, check each index if in the range [32 -47] or
* [58-64]
*
*
* // if a symbol, increment the count
*
*
* // return the answer
*/
public boolean checkSymbols(String pass) {
int count = 0;
// loops over the string length
for (int i = 0; i < pass.length(); i++) {
// checks if the char code of current character lies within the given range
if ((pass.charAt(i) <= 47 && pass.charAt(i) >= 32)) {
// increment the count
count++;
}
if ((pass.charAt(i) <= 64 && pass.charAt(i) >= 58)) {
count++;
}
}
// checks if counted symbols are greater than equal to numSymbols
if (count >= numSymbols) {
return true;
}
return false;
}
/**
* ( 2 points) Create a method that takes a string password , the method checks
* if the password has at least the required number of digits and return true,
* false otherwise the style of this method will be similar to the previous
* method use the range in the Ascii table [48 -57] for digits
*/
public boolean checkDigits(String pass) {
int count = 0;
// too loop over the the pass
for (int i = 0; i < pass.length(); i++) {
// checks if the char code of current character lies within the given range
if ((pass.charAt(i) <= 57 && pass.charAt(i) >= 48)) {
count++;
}
}
// checks if counted symbols are greater than equal to numSymbols
if (count >= numDigits) {
return true;
}
return false;
}
/**
* ( 2 points)Create a method that takes a string password , the method checks
* if the password has at least the required number of capital letters and
* return true, false otherwise the style of this method will be similar to the
* previous method use the range in the Ascii table [65 -90] for capital letters
*/
boolean checkCaps(String pass) {
int count = 0;
// this method follows the same algoritmn as the above given methods
for (int i = 0; i < pass.length(); i++) {
if ((pass.charAt(i) <= 90 && pass.charAt(i) >= 65)) {
count++;
}
}
if (count >= numCap) {
return true;
}
return false;
}
/**
* ( 2 points) Create a method that takes a string password , the method checks
* if the password has at least the required number of lowercase letters and
* return true, false otherwise the style of this method will be similar to the
* previous method use the range in the Ascii table [97 -122] for lowercase
* letters
*/
boolean checkSmall(String pass) {
int count = 0;
// this method follows the same algoritmn as the above given methods
for (int i = 0; i < pass.length(); i++) {
if ((pass.charAt(i) <= 122 && pass.charAt(i) >= 97)) {
count++;
}
}
if (count >= numSmall) {
return true;
}
return false;
}
/** (2 points) create a getter method to return the password */
String getPassword() {
return password;
}
/** ( 15 points) Create a setter method to set the password */
public void setPassword() {
// Declare a String to hold a password
String pass = "";
// Declare a scanner object to receive a password from the keyboard
Scanner scanner = new Scanner(System.in);
// Declare a boolean variable and set it to true
// Which assumes the password meets the settings.
boolean flag = true;
// Loop until the user provides a correct password
while (flag) {
// prompt the user to enter the password ,
// specify the requirements based in the settings
System.out.println("The password must meet special requirements, for instance , it has to be of length"
+ length + ", contains at least " + numCap + " capital letters , " + numSmall
+ " lowercase letters, " + numSymbols + " symbols and " + numDigits + " digits.");
System.out.print("Please enter a password: ");
// scan the next line and store in the String holding the password
pass = scanner.nextLine();
/*
* If the password provided is not equal to the length required, then print out
* an error message
*/
if (!this.validLength(pass)) {
System.out.println("The string does not have the length required");
}
/*
* If the password doesn't have the required number of capital letters then
* print out a message
*/
else if (!this.checkCaps(pass)) {
System.out.println("The string does not have the required number of captial letters.");
}
/*
* If the password doesn't have the required number of lowercase letters then
* print out a message
*/
else if (!this.checkSmall(pass)) {
System.out.println("The string does not have the required number of small letters.");
}
/*
* If the password doesn't have the required number of symbols then print out a
* message
*/
else if (!this.checkSymbols(pass)) {
System.out.println("The string does not have the required number of symbols.");
}
/*
* If the password doesn't have the required number of digits then print out a
* message
*/
else if (!this.checkDigits(pass)) {
System.out.println("The string does not have the required number of digits.");
}
/*
* if the password meets all of the settings, then password provided is valid
*
* set the global variable password to the new qualified password set the flag
* to false, to stop iterations
*/
else {
flag = false;
this.password = pass;
break;
}
}
}
/**
* (8 points)create the main method
*/
public static void main(String[] args) {
// Declare an instance of Password using the default constructor
Password p = new Password();
// print out the password, using the getter method
System.out.println(p.getPassword());
// What is the default password ?..................
// Use the setter method to set a password
p.setPassword();
// Print out the password using the getter method
System.out.println(p.getPassword());
/*
* Declare an instance of the password using the overloaded constructor, the
* settings for new password object are: (2 Captial letters,2 Lowercase letters,
* 2 Symbols , 2 Numbers)
*/
Password p2 = new Password(2, 2, 2, 2);
// Set the password using the setter method.
p2.setPassword();
// Print out the password using the getter method
System.out.println(p2.getPassword());
}
}
Hey all, if you could create a java program following these guidelines that would be much...
JAVA PROBLEM! PLEASE DO IT ASAP!! REALLY URGENT! PLEASE DO NOT POST INCOMPLETE OR INCORRECT CODE Below is the program -- fill the code as per the instructions commented: //---------------------------------------------------------------------------------------------------------------------------------------------------------------// /* The idea of this HW is as follows : A password must meet special requirements, for instance , it has to be of specific length, contains at least 2 capital letters , 2 lowercase letters, 2 symbols and 2 digits. A customer is hiring you to create a class...
Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows: public class Course...
Java Program (PLEASE PROVIDE SCREENSHOT OF THE CODE) Create a class Person which is a super class. The class includes four private String instance variables: first name, last name, social security number, and state. Write a constructor and get methods for each instance variable. Also, add a toString method to print the details of the person. After that create a class Teacher which extends the class, Person. Add a private instance variable to store number of courses. Write a constructor...
JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...
**IN JAVAAssignment 10.1 [95 points]The WordCruncher classWrite the Java code for the class WordCruncher. Include the following members:A default constructor that sets the instance variable 'word' to the string "default".A parameterized constructor that accepts one String object as a parameter and stores it in the instance variable. The String must consist only of letters: no whitespace, digits, or punctuation. If the String parameter does not consist only of letters, set the instance variable to "default" instead. (This restriction will make...
You are to create a class Appointment.java that will have the following: 5 Instance variables: private String month private int day private int year private int hour private int minute 1 default constructor public Appointment() 1 non-default constructor that accepts arguments for all instance variables, your constructor must call the setter methods below to set the values of the instance variables public Appointment(String monthPassed, int dayPassed, int yearPassed, int hourPassed, int minutePassed) 5 setter methods (one for each instance variable)...
Create a simple Java class for a Password with the following requirements: This program will have a header block comment with your name, the course and section, as well as a brief description of what the class does. One String property: password (protected to only allow secure passwords) o A secure password must be at least 8 characters in length o A secure password must have three of the following four requirements: A lower case letter ...
Here is a sample run of the tester program: Make sure your program follows the Java Coding Guidelines. Consider the following class: /** * A store superclass with a Name and Sales Tax Rate */ public class Store { public final double SALES_TAX_RATE = 0.06; private String name; /** * Constructor to create a new store * @param newName */ public Store(String newName) { name = newName; } ...
Anyone helps me in a Java Languageif it it is possible thanks. Write a class called Player that holds the following information: Team Name (e.g., Ravens) . Player Name (e.g., Flacco) . Position's Name (e.g. Wide reciver) . Playing hours per week (e.g. 30 hours per week). Payment Rate (e.g., 46 per hour) . Number of Players in the Team (e.g. 80 players) . This information represents the class member variables. Declare all variables of Payer class as private except...
STORAGE WARS - Create a class with the name and variables/attributes listed below. Create a default Constructor with no parameters that assigns default values for each variable. Then, create an overloaded Constructor (with one parameter for each variable). Finally, create a method that returns the total number of items in the storage container. NOTE: this method must not print anything. (50 points) Make sure to clearly label the variables/attributes, Constructors and Methods and to indicate which language you are answering...