i need to get a new password instead of old password I have two java classes, while one contains the getters and setters the other is a driver class. I need the user input from the scanner in the driver class to be in one of the setters in the first class. The user input has to be a int because it will be used as a formula in the setter.
class Account
{
private int Pwd;
Account(int Pwd)
{
this.Pwd=Pwd;
}
public void setPwd(int oldPwd,int newPwd)
{
if(this.Pwd==oldPwd)
{
this.Pwd=newPwd;
System.out.println("Password is changed");
}
else
{
System.out.println("password mismatch");
}
}
public boolean verifyPwd(int pwd)
{
if(this.pwd==pwd)
{
return true;
}
else
{
return false;
}
}
}
import java.util.Scanner;
class SbiDriver
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in); //scanner
Account a=new Account(int Pwd);
int oldPwd=s.nextInt();
int newPwd=s.nextInt();
setPwd(oldPwd,newPwd);
}
}
//constructor have not work well i thing //i need to getting new pasword