#Username and Password

1 messages Β· Page 1 of 1 (latest)

rare pythonBOT
#

<@&987246399047479336> please have a look, thanks.

rare pythonBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

manic zephyr
rare pythonBOT
# manic zephyr

I uploaded your attachments as gist. That way, they are easier to read for everyone, especially mobile users πŸ‘

manic zephyr
rare pythonBOT
# manic zephyr

I uploaded your attachments as gist. That way, they are easier to read for everyone, especially mobile users πŸ‘

stray minnow
#

Main


public class UsernameAndPassword {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        
        Scanner input = new Scanner(System.in);
        
        ArrayList<credentials> credlist = new ArrayList<credentials>();
        
        System.out.print("Username: ");

        String username = input.nextLine();

        
        System.out.print("Password: ");
        String password = input.nextLine();
        
        credlist.add(new credentials(username, password));

            System.out.println("Do you wish to change password? y/n");

        String result = input.nextLine();
        
        if (result.equals("y")){
            
            // Change password and add new password
            System.out.println("New password");
            String newpassword = input.nextLine();
            
            // Old Account
            System.out.println("Old account");
        
            System.out.println("Username: " + credlist.get(0).getusername());
            System.out.println("Password: " + credlist.get(0).getpassword());
            
            credlist.get(0).Updatepassword(newpassword);
            
            // Updated Account
            System.out.println("Updated account");
        
            System.out.println("Username: " + credlist.get(0).getusername());
            System.out.println("Password: " + credlist.get(0).getpassword());
            
        } else {
            System.out.println("Thank you");
        }
    
        
        
        }
}

#

Object


public class credentials {
    
    
    public String username;
    private String password;
    public String result;
    
    public credentials(String username,String password){
        
        this.username = username;
        this.password  = password;
       
        
    }
    
    public String getusername(){
         
         return this.username;
    } 
  
    
    public String getpassword(){
         
         return this.password;
         
    }
    
    public void Updatepassword(String newpassword){
        
        this.password = newpassword;
          
    }
    
    public String returnafterUpdatepassword(String manufacturer){
        
        return this.password;
    }
    
    
    
    
}

I can't figure out what to do with returnafterUpdatepassword
but that's how you can update the value using object methods ^^

rare pythonBOT
# stray minnow Object ```java public class credentials { public String username;...

Detected code, here are some useful tools:

Formatted code
public class credentials {
  public String username;
  private String password;
  public String result;
  public credentials(String username, String password) {
    this .username = username;
    this .password = password;
  }
  public String getusername() {
    return this .username;
  }
  public String getpassword() {
    return this .password;
  }
  public void Updatepassword(String newpassword) {
    this .password = newpassword;
  }
  public String returnafterUpdatepassword(String manufacturer) {
    return this .password;
  }
}
manic zephyr
bitter iris
stray minnow
#

The code is not mine, the code I put is his/her, I just showed him/her how to do it, I just added something for him/her to review if I just tell him/her what to do without showing anything, everything will definitely be confusing ^^ and it also just ends up writing my own code for him/her

but don't worry, I'm not giving away my own code ^^ @bitter iris

unless they pay me🀣

manic zephyr