Course Solutions Uncategorized (Solved) : Need Change Java Code Set Want Add Method Best Way Adding Method Existing Code Private Voi Q30082243 . . . .

(Solved) : Need Change Java Code Set Want Add Method Best Way Adding Method Existing Code Private Voi Q30082243 . . . .

 

I need to change Java code set up I want to add a method. Whatis the best way of adding the method?

Existing code

private void LogsubmitActionPerformed(java.awt.event.ActionEventevt){                                        
     
        try {
           String password = jPassword.getText();
           String username = jtxtUsername.getText();
         
           File texting = new File(“Log.txt”);
           //open file in append mode
           BufferedWriter writer;
           writer = new BufferedWriter(new FileWriter(texting,true));
           //date and time
           Date currentTime =Calendar.getInstance().getTime();
           boolean valid = false;
           //used a hard-coded username and password
           if(username.equals(“anna”)&&(password.equals(“password”)))
           {
               jtxtUsername.setText(null);
               jPassword.setText(null);
              
               JOptionPane.showMessageDialog(null, “success”);
               writer.write(username + currentTime);
               writer.write(“success”);
               valid = true;
          
           }
           else if(!valid)
          
           JOptionPane.showMessageDialog(null, “invalid password”);
           writer.write(password + currentTime);
           writer.write(“failed”);
           writer.close();
          
          
        } catch (IOException ex){
           Logger.getLogger(LoginApp.class.getName()).log(Level.SEVERE, null,ex);
        }
                                            
   }                                  

I would like to add public boolean testUser(String jtxtUsername,String jPassword) after the private voidLogsubmitActionPerformed(java.awt.event.ActionEvent evt) method.When I add I get an error of illegal start of expression.
       

Expert

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post