Acc 683Topics in Accounting Information Systems (Web Application Development & XML)

Spring, 2001 (March 14, 2001)

Jagdish S. Gangolly

INSTRUCTIONS

  1. This is an open notes/books test.
  2. However, you will not have time during the test to discover knowledge.
  3. Maximum time limit: 80 minutes.
  4. Answer all questions.
  5. Some famous quotes:

"All right everyone, line up alphabetically according to your height."(Casey Stengel)

"When you come to a fork in the road, take it." (Yogi Berra)

"You better cut the pizza in four pieces because I'm not hungry enough to eat six." (Yogi Berra)

" I couldn't tell if the streaker was a man or a woman because it had a bag on it's head." (Yogi Berra)

"You can observe a lot just by watchin'." (Yogi Berra)

Yogi Berra on seeing a Steve McQueen movie: - "He must have made that before he died"

"If you can't imitate him, don't copy him." (Yogi Berra)

Mrs. Lindsay - "You certainly look cool." - Yogi Berra - "Thanks, you don't look so hot yourself."

"Nobody goes there anymore; it's too crowded." (Yogi Berra)

"You got to be very careful if you don't know where you're going, because you might not get there." (Yogi Berra)

"It was impossible to get a conversation going, everybody was talking too much." (Yogi Berra)

1

Question 1. (Servlets) 25 points

Consider the two programs implementing the doGet method in a servlet. The two implementations do the same thing, but in different ways.

Answer the following questions based on these two programs:

Example 1.
public void doGet ( HttpServletRequest req,
HttpServletResponse res )
throws ServletException,IOException
{
res.setContentType( "text/html" );
String html = "<html<head<title>Example1</title</head>\n";
html += "<body>\n";
html += "<h1>Countdown</h1>\n";
for ( int i = 10; i > 0; i-- ) {
html += "<h1>" + i + "</h1>";
}
html += "<h1>Liftoff</h1>\n";
html += "</body</html>\n";
PrintWriter out = res.getWriter();
out.println( html );
out.close();
} / Example 2
public void doGet ( HttpServletRequest req,
HttpServletResponse res )
throws ServletException, IOException
{
res.setContentType( "text/html" );
PrintWriter out = res.getWriter();
out.println( "<html<head<title>Example
2</title</head>" );
out.println( "<body>" );
out.println( "<h1>Countdown</h1>" );
for ( int i = 10; i > 0; i-- ) {
out.print( "<h1>" );
out.print( i );
out.println( "</h1>" );
}
out.println( "<h1>Liftoff</h1>" );
out.println( "</body</html>" );
out.close();
}
  1. Write the output you expect when the servlets are run, in the space provided below: (10 points)
  1. In the space provided below, discuss the differences between the two programs with respect to the number of objects created.(10 points)
  1. Which way of writing the doGet method do you prefer? Why? (5 points)

1

Question 2. XML 25 points

Consider the following instance of an XML document of the type email:

<email>

<head>

<from> <name>Tim Bray</name> <address></address> </from>

<to> <name>Paul Dreyfus</name> <address></address>

</to>

<subject> First draft of XML intro </subject>

</head>

<body>

<p>Here's a draft of that XML article. I'll be on the road but

connected to e-mail. Let me know if it hits the right level (i.e., are

major revisions in order?). If it's fine, proceed with editorial

nit-pickery. -Tim</p>

<attach encoding="mime" name="xml-draft.html"/>

</body>

</email>

You are also told that the following rules must be observed by every email document:

  • An EMAIL has to have a HEAD and a BODY.
  • The HEAD has to have a FROM, one or more TOs, zero or more CCs, and a SUBJECT.
  • The FROM and the TO can both include a NAME, and they have to include an ADDRESS.
  • The NAME, ADDRESS, and SUBJECT are all just text.
  • The BODY is a mixture of Ps and ATTACHes.
  • A P contains just text.
  • An ATTACH doesn't contain anything, but it has an ENCODING attribute whose value can be either mime or binhex; if it's not there, the default is mime. An ATTACH also has a NAME attribute whose value can be any text, but has to be there.

Required:On the next page, create a Document Type Definition (DTD) for email based on the above constraints. (25 points)

Question 3. UML/XML 25 points

On the next page is the very recently issued Voluntary Interindustry Commerce Standards (VICS) Association proposed standard bill of lading.

Study it carefully.

Required:

  1. In the space below, provide the class diagram for the Bill of Lading form. Please feel free to make any assumptions in drawing the diagram, but state such assumptions explicitly. (25 points)
  2. On the page following the Bill of Lading Form, provide the sketch (without any specific Bill of Lading data, ie., blank) of an XML document based on the class diagram you provided in 1. above. Do not get bogged down in the minute detaiIs in the document. I am trying to find out if you have understood the basic concepts of class modeling and its application to XML. (25 points)

1

1

1