Question

When a user signs in for the first time to a website, the user has to...

When a user signs in for the first time to a website, the user has to submit personal information, such as userid, name, email address, telephone number and so on. Typically, there are two fields for passwords, requiring the user to enter the password twice, to ensure that the user did not make a typo in the first password field. Write a class encapsulating user with the following elements: UserID Password Reentered password Email address Name Street Address City State Zip You will store these values as strings. Write the following methods in your class: 1. A constructor which will initialize the 9 attributes listed above. 2. Accessor, mutator, toString methods 3. A method returning the number of characters in the userid 4.. A method checking if the two Strings representing the password fields are the same, if they are return true, otherwise false. Write a test class to create 2 user objects (using your constructor) and test all the methods in your class. Remember to submit all your .java files, .class files and screenshots of your code and output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

reigistration.java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package reg;

/**
*
* @author JOSEE
*/
public class reigistration
{
private String UserId,password,Reentered_password,Email,Name,Street,city,State,Zip;
public reigistration(){};
public reigistration(String uid,String pass,String re_pass,String mail,String name,String strt,String city,String state,String zp)
{
this.UserId=uid;
this.password=pass;
this.Reentered_password=re_pass;
this.Email=mail;
this.Name=name;
this.Street=strt;
this.city=city;
this.State=state;
this.Zip=zp;
}
public void setUsertId(String uid)
{
this.UserId=uid;
}
public void setPassword(String pwd)
{
this.password=pwd;
}public void setReEnterPassword(String repws)
{
this.Reentered_password=repws;
}
public void setEmail(String mail)
{
this.Email=mail;
}
public void setName(String nm)
{
this.Name=nm;
}
public void setStreet(String str)
{
this.Street=str;
}
public void setCity(String cty)
{
this.city=cty;
}public void setState(String st)
{
this.State=st;
}public void setZip(String zp)
{
this.Zip=zp;
}
public String getUserId()
{
return this.UserId;
}
public String getPassword()
{
return this.password;
}
public String getReEnteredPassword()
{
return this.Reentered_password;
}
public String getEmail()
{
return this.Email;
}
public String getName()
{
return this.Name;
} public String getState()
{
return this.State;
} public String getStreet()
{
return this.Street;
} public String getCity()
{
return this.city;
}
public String getZip()
{
return this.Zip;
}
public boolean matchPassword(String pwd1,String pwd2)
{
return pwd1.equals(pwd2);
}
@Override
public String toString()
{
return "Name : "+this.Name+"\nUser Id " +this.UserId+"\npassword : "+this.password+"\nRe-Password : "+this.Reentered_password+"\nEmail : "+this.Email+" \nAdress\nStreet :"+this.Street+"\nCity : "
+this.city+"\nState : "+this.State+"\nZip : "+this.Zip;}
  

}

Test.java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package reg;

/**
*
* @author JOSEE
*/
public class Test {

/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
reigistration ob1;
ob1 = new reigistration("joseejay79","jay@123","jay@123","[email protected]","Jay","Main Bazar","Bhuj","Gujarata","370020");
System.out.println(ob1);
System.out.println("If user1 's both password are same :"+ob1.matchPassword(ob1.getPassword(), ob1.getReEnteredPassword()));
reigistration ob2=new reigistration();
ob2.setUsertId("Viral123");
ob2.setPassword("Viral@xyz");
ob2.setReEnterPassword("viral@123");
ob2.setCity("Bhuj");
ob2.setEmail("[email protected]");
ob2.setName("Viral");
ob2.setStreet("Street-2");
ob2.setState("Delhi");
ob2.setZip("370001");
System.out.println("Name : "+ob2.getName()+"\nUser Id :" +ob2.getUserId()+"\npassword : "+ob2.getPassword()+"\nRe-Password : "+ob2.getReEnteredPassword()+"\nEmail : "+ob2.getEmail()+" \nAdress\nStreet :"+ob2.getStreet()+"\nCity : "+ ob2.getCity()+"\nState : "+ob2.getState()+"\nZip : "+ob2.getZip());
System.out.println("If user2 's both password are same :"+ob2.matchPassword(ob2.getPassword(), ob2.getReEnteredPassword()));
}
  
}

outpu

FormRegClass - NetBeans IDE 8.0.1 File Edit View Navigate Source Refactor Run Debug Profie Teem Iools Window Help Search (Ct1+) default config> -Y. T 1> .肠 reigistraton.java xTest.java » ProjectsFiles Services 甲·クColectionMethod Output- FormRegClass (run) Source un: 11 Name : Jay User Id joseejay79 pasoword jay 123 Re-Password jay8123 Email : joseejayabe.com Adress Strect :Main Bazar City Bhuj State Gujarata zip : 370020 If userl 3 both password are same :true Name Viral User Id viral123 password: viral@xyz Re-Password viral2123 Email Viral&yxc.com Adress Street :Street-2 CityBhuj State Delhi zip : 370001 If user2 s both password are same :false BUILD SUCCESSFUL (total time : 1 ธecond) Output 102:72 INS O Type here to search ^D q, ENG 22:02 18-09-2018 2if you have any problem regarding the code please ask me in the comment i am here for the help. thank you please do thumbs up for me.

Add a comment
Know the answer?
Add Answer to:
When a user signs in for the first time to a website, the user has to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Design a class named Person with fields for holding a person's name, address, and telephone number...

    Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person class. The Customer class should have a String field for the customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write a constructor that initializes...

  • You will need to first create an object class encapsulating a Trivia Game which INHERITS from...

    You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game. Game is the parent class with the following attributes: description - which is a string write the constructor, accessor, mutator and toString methods. Trivia is the subclass of Game with the additional attributes: 1. trivia game id - integer 2. ultimate prize money - double 3. number of questions that must be answered to win - integer. 4. write the accessor, mutator, constructor,...

  • This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones...

    This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones in which one letter is substituted for another. Although their output looks impossible to read, they are easy to break because the relative frequencies of English letters are known. The Vigenere cipher improves upon this. They require a key word and the plain text to be encrypted. Create a Java application that uses: decision constructs looping constructs basic operations on an ArrayList of objects...

  • Write a class encapsulating the concept of daily temperatures for a week with a single dimensiona...

    Write a class encapsulating the concept of daily temperatures for a week with a single dimensional array of temperatures. Write the following methods: • A constructor accepting an array of seven temperatures as a parameter. • Accessor, mutator, toString() and equals() methods • A method returning how many temperatures were below freezing. • A method returning an array of temperatures above 100 degrees. • A method returning the largest change in temperature between any two consecutive days. • A method...

  • User Profiles Write a program that reads in a series of customer information -- including name,...

    User Profiles Write a program that reads in a series of customer information -- including name, gender, phone, email and password -- from a file and stores the information in an ArrayList of User objects. Once the information has been stored, the program should welcome a user and prompt him or her for an email and password The program should then use a linearSearch method to determine whether the user whose name and password entered match those of any of...

  • In JAVA, please In this module, you will combine your knowledge of class objects, inheritance and...

    In JAVA, please In this module, you will combine your knowledge of class objects, inheritance and linked lists. You will need to first create an object class encapsulating a Trivia Game which INHERITS from Game. Game is the parent class with the following attributes: 1. description - which is a string 2. write the constructor, accessor, mutator and toString methods. Trivia is the subclass of Game with the additional attributes: 1. trivia game id - integer 2. ultimate prize money...

  • In 6A, you created an object class encapsulating a Trivia Game which INHERITS from Game. Now...

    In 6A, you created an object class encapsulating a Trivia Game which INHERITS from Game. Now that you have successfully created Trivia objects, you will continue 6B by creating a linked list of trivia objects. Add the linked list code to the Trivia class. Your linked list code should include the following: a TriviaNode class with the attributes: 1. trivia game - Trivia object 2. next- TriviaNode 3. write the constructor, accessor, mutator and toString methods. A TriviaLinkedList Class which...

  • I need the following written in Java please, thank you ' We want you to implement...

    I need the following written in Java please, thank you ' We want you to implement a java class that will show details on users and throw exceptions where needed. The following requirements specify what fields you are expected to implement in your User class: - A private String firstName that specifies the first name of the user - A private String lastName that specifies the last name of the user - A private int age that specifies user's age...

  • Write a class named PhoneBookEntry that has fields for a person's name and phone number.The class...

    Write a class named PhoneBookEntry that has fields for a person's name and phone number.The class should have a constructor and appropriate accessor and mutator methods. Thenwrite a program that creates at least five PhoneBookEntry objects and stores them in anArrayLitt. Use a loop to display the contents of each object in the ArrayList.

  • Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters...

    Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters long encryptedPassword : String key int Must be between 1 and 10(inclusive) accountId - A unique integer that identifies each account nextIDNum – a static int that starts at 1000 and is used to generate the accountID no other instance variables needed. Default constructor – set all instance variables to a default value. Parameterized constructor Takes in clearPassword, key. Calls encrypt method to create...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT