Assignment No. 5 Total Marks 30 Marks Note:- We have discussed different things
ID: 3612211 • Letter: A
Question
Assignment No. 5
Total Marks 30 Marks
Note:-
We have discussed different things regarding SoftwareCoding in lectures from 28-35. Writing a maintainable code makesthe product with High Quality. Here you are given a scenario whereyou have to write a maintainable code for the givenproblem.
Scenario:
Virtual Solutions is an IT solution provider company. It has hiredyou as a Software Engineer. Your job is to write code, but at thesame it should be of High Quality. Your Team Lead has askedyou to write a very small code of user login functionality. Thecode should be of High Quality.
You are required to
a. Write correct code for the user loginin Java or C++ following the guidelines for writing code discussedin the lectures
(15 marks)
b. Make use of Hungarian Notation forcoding purpose
(10 marks)
GOOD LUCK.
Explanation / Answer
Response Details:
Dear...
1) Login page in jsp
<%@ page language ="java" import="java.sql.*" %>
<html>
<bodybgcolor="pink">
<form name="f1"method="post">
<table>
<tr>
<td>UserName</td>
<td><inputtype="text" name="t1" ></td>
</tr>
<tr>
<td>Password</td>
<td><input type=""password"" name="t2"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="b1"value="LogIn"></td>
</tr>
</table>
<form>
<body>
<%
Stringuser=request.getParameter("t1");
Stringpass=request.getParameter("t2");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connectioncon=DriverManager.getConnection("jdbc:odbc:mydsn", "jp", "jp");
Statementst=con.createStatement();
ResultSetrs=st.executeQuery("select username,password from userlog");
while(rs.next())
{
String username=rs.getString(1);
String password=rs.getString(2);
if(user.equals(username) && pass.equals(password))
{
%>
<jsp:forward page="/…/LoginSuccess.jsp" />
<%
}
else
out.println("Login Failed,Please try Againe");
%>
<%
}
}
catch(Exception e1)
{
}
%>
</form>
</body>
</html>
2) Use of Hungarian Notation for coding purpose
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.