avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday June 23, 2021, 10:35 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Plz tell me how can i bring high quality to this Java code. it's urgent  (Read 4478 times)


  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
well, i have written this code for the problem give below. Plz help me to bring high quality to this i.e use of Hungarian Notation and commnts as required in the problem given below:
Writing a maintainable code makes the product with High Quality. Here you are given a scenario where you have to write a maintainable code for the given problem.


Virtual Solutions is an IT solution provider company. It has hired you as a Software Engineer. Your job is to write code, but at the same it should be of High Quality.  Your Team Lead has asked you to write a very small code of user login functionality. The code should be of High Quality.

You are required to

a.   Write correct code for the user login in Java or C++
b.   Make use of Hungarian Notation for coding purpose
c.   Make use of Comments in the Code where required necessary.


<title>Khalid Mahmood   </title>

 <p> <h3><center>Please enter your user name and

 <form  action="process2.jsp "    method = "post" >
 <center><input type = "text" name=
 <center><input type = "password" name =
 <center><input type="submit"     name="Submit"



<%@ page import="java.util.*" %>
<jsp:useBean id="idHandler" class="foo.Login" scope="request">
<jsp:setProperty name="idHandler" property="*"/>

   if (idHandler.validate()) {
<jsp:forward page="success.jsp"/>
   }  else {
<jsp:forward page="retry.jsp"/>

package foo;
 import java.sql.*;

 public class Login {

   private String username = "";
 private String password = "";

   public Login() {

  public void setUsername(String username) {
     this.username = username;

  public void setPassword(String password) {
     this.password = password;

 public boolean  authenticate(String username2,
 String password2) {
  String query="select * from Registration;";
   String DbUserName="";
   String DbPassword="";
   String finalUser="";
  try {
   Statement stat=con.createStatement();
   ResultSet rst=stat.executeQuery(query);



   if (username2.equals(DbUserName) &&
 password2.equals(DbPassword)) {


 return true;
 }catch(Exception e){

 return false;


  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,152
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Pay more attention in class? :)
- carpe noctem


  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 59
  • hey!
    • View Profile
    • Personal Website
    • Donate to Member
Hey, where did ya get that? facebook puzzles?

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,613
    • View Profile
    • Donate to Member
So just add commenting to the code in Hungarian...