Text Processing: User Name and Password
Write a Java program that consists of at least three methods:
- main method
- a method that assigns a user ID.
- a method that returns a password if a user provides the same password twice.
Program:
import java.util.*;
class LoginDemo
{
String userID,password,cPassword;
Scanner sc;
LoginDemo()
{
sc=new Scanner(System.in);
}
public String getUserID()
{
System.out.print("\nEnter userID: ");
userID=sc.next();
return userID;
}
public String getPassword()
{
while(true)
{
System.out.print("\nEnter your password: ");
password=sc.next();
System.out.print("\nEnter Confirm password: ");
cPassword=sc.next();
if(password.equals(cPassword))
{
System.out.println("\nPassword set successfully!!");
return password;
}
else
{
System.out.println("\nPlease enter same passwords!!");
}
}
}
public static void main(String args[])
{
LoginDemo login=new LoginDemo();
String userid=login.getUserID();
String password=login.getPassword();
System.out.println("\n\nLogin credentials:");
System.out.println("------------------------------------------------\n");
System.out.println("\nUser ID: "+userid);
System.out.println("\nPassword: "+password);
System.out.print("\n");
}
}
Output:


Text Processing: User Name and Password Write a Java program that consists of at least three...
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 ...
FOR JAVA: Summary: Write a program to assess password stringency. The solution should be named Password.java. Include these steps: Write an application that provides the criteria for a strong password, and accepts a user's password from an input dialog box. If the entered password is less than six characters, more than 10 characters, or does not contain at least one uppercase letter and one digit, prompt the user to enter again. When the user's entry meets all the password requirements,...
Write a Java program that has the following methods: findSum - a method that takes in three integers and returns the sum of these three integers; findAverage - a method that takes in three integers and returns the average of these three integers (as a double value) Within the main method read in 3 integers from the user and call above two methods by passing the three integers. Your program should print the user provided three integers and results of...
Write a program in Java that prompts a user for Name and id number. and then the program outputs students GPA MAIN import java.util.StringTokenizer; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { String thedata = JOptionPane.showInputDialog(null, "Please type in Student Name. ", "Student OOP Program", JOptionPane.INFORMATION_MESSAGE); String name = thedata; Student pupil = new Student(name); //add code here ...
write a program in java that asks the user for a sentence, and then returns that string with the words backwards. For example: Enter a sentence! Mary had a little lamb. Your sentence backwards: lamb. little a had Mary Write a method called reverse() that accepts a sentence as a string, and then returns that string with the words backwards. Write a main() method that gets the string from the user and then displays the string backwards. demonstrate program by...
Java Programming Reading from a Text File
Write a Java program that will use an object of the Scanner class to read employee payroll data from a text file The Text file payroll.dat has the following: 100 Washington Marx Jung Darwin George 40 200 300 400 Kar Car Charles 50 22.532 15 30 The order of the data and its types stored in the file are as follows: Data EmployeelD Last name FirstName HoursWorked double HourlyRate Data Tvpe String String...
I need java code for the following problem.
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...
Write a complete JAVA program to do the following program.
The main program calls a method to read in (from an input file) a set of people's three-digit ID numbers and their donations to a charity (hint: use parallel arrays)Then the main program calls a method to sort the ID numbers into numerical order, being sure to carry along the corresponding donations. The main program then calls a method to print the sorted 1ists in tabular form, giving both ID...
Write a Java program that prompts the user to enter a password that matches a specific pattern. Your program must approve the user's entry.. Here is the pattern, in this order: 1 or more upper case letters two lower case letters 1 or 2 digits zero or 1 upper case letters any two of this group @#$%^&
Write a program in java (consists of three files) that uses class-objects to calculate temperature in Fahrenheit and Centigrade. That is, there are at least three classes. The problem is to write a three classes (3) that calculate the temperature either in Fahrenheit or Celsius. This action should be repeatable. This demonstrates use of a menu to give user a choice. Use of proper syntax for named constants, variables, reference variables, constructors, getter and setter and display methods is expected....