Below is my class7 project You will be modifying the old man code from class 7 t
ID: 3598482 • Letter: B
Question
Below is my class7 projectYou will be modifying the old man code from class 7 to include a boolean variable and two loops. The following lists the requirements as overviewed in class: Boolean variable and loop one 1. Add in a boolean variable to keep track of whether the loop is done or not 2. Add in a While loop, which tests on the boolean variable, that allows the user to continue to guess until they finally get it right. Loop two In the class 7 project when the user finally gets it right you moved the red corvette onto the screen and stopped it near the old man. The new addition will take place right after the car stops. The new addition is to have the car do a little donut (the car somewhat makes a circle). 1. Setup a loop (using a While or Loop) to execute four times 2. Inside the loop have the following steps done together car turn 1/4 turn (left or right, whichever looks better) car move forward a short distance
Explanation / Answer
<%@ page errorPage="error.jsp" import="java.util.Set,java.util.Iterator,java.util.Map,chat.*"%>
<%
String nickname = request.getParameter("chatterName");
%>
<HTML>
<HEAD>
<META http-equiv="pragma" content="no-cache">
<meta name="Author" content="Sukhwinder Singh (ssruprai@hotmail.com">
<TITLE><%=nickname%>'s information</TITLE>
<LINK rel="stylesheet" href="<%=request.getContextPath()%>/chat.css" type="text/css">
</HEAD>
<BODY bgcolor="#FFFFFF">
<%
if (nickname != null)
{
ChatRoomList roomList = (ChatRoomList)application.getAttribute("chatroomlist");
ChatRoom chatRoom = roomList.getRoomOfChatter(nickname);
if (chatRoom != null)
{
Chatter chatter = chatRoom.getChatter(nickname);
%>
<div align="center">
<center>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<TD valign="top"><h4>Nickname: </h4></td><TD valign="top"><%=nickname%></td>
</tr>
<tr>
<TD valign="top"><h4>Sex: </h4></td><TD valign="top"><%=chatter.getSex()%></td>
</tr>
<tr>
<TD valign="top"><h4>Age: </h4></td><TD valign="top"><% int age = chatter.getAge();
if(age == -1)
out.write("Not specified");
else
out.write(String.valueOf(age));
%></td>
</tr>
<tr>
<TD valign="top"><h4>Email: </h4></td><TD valign="top"><% String email = chatter.getEmail();
if (email != null && email.length() >0)
out.write(email);
else
out.write("Not specified");
%></td>
</tr>
<tr>
<TD valign="top"><H4>Comment: </h4></td><TD valign="top"><%
String comment = chatter.getComment();
if (comment != null && comment.length() >0)
out.write(comment);
else
out.write("Not specified");
%></h4>
</tr>
<tr><TD valign="top"> </td>
<TD valign="top">
<form name="closing">
<input type="button" value="Close">
</form>
</td>
<tr>
</table>
</center>
</div>
<%
}
else
{
%>
<div align="center">
<center>
<span class="error">User <%=nickname %> doesn't exist.<br>He / She may have logged out.</span>
<form name="closing">
<input type="button" value="Close">
</form>
</center>
</div>
<%
}
}
else
{
%>
<div align="center">
<center>
<span class="error">No username provided.</span>
</center>
</div>
<%
}
%>
</BODY>
</HTML>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.