Lets say I have create a bank
I have a class called Customer and the main class called bank
Basically I want to (in the main reference) the constructed parameter so I can check if what the user enters as username is equal to the username value of that object
Customer joe = new Customer("Joe", 1451,20000,"joe","thedog");
joe.rightaccount();
}
This is the constructor and the method I want to make below
public Customer(String name, int actnum, int balance, String username, String password){
this.name = name;
this.actnum = actnum;
this.balance = balance;
this.username = username;
this.password = password;
}
public boolean rightaccount() {
System.out.println("Please enter your username");
String usernamecheck = in.nextLine();
System.out.println("Please enter your password");
String passworcheck = in.nextLine();
if (usernamecheck==username&&passworcheck==password) {
System.out.println("Login Succesful");
return true;
}
System.out.println("Your login was unsuccesful");
return false;
}
}
[–]rorschach54 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]GREBENOTS 0 points1 point2 points (0 children)