Assignment -2 , 230 Zero Plagiarism

profilesmartman1212
IT230-Assignment-2.zip

IT230-Assignment-2.docx

Pg. 01

Question Three

Assignment 2

Deadline: Thursday 19/11/2020 @ 23:59

[Total Mark for this Assignment is 6]

Web Technologies

IT230

https://www.seu.edu.sa/sites/ar/SitePages/images/logo.png

College of Computing and Informatics

Question One

1 Marks

Learning Outcome(s):

Build web applications using PHP or similar languages.

What is a Servlet? What is the main job of HttpServletRequest and HttpServletResponse?

Answer:

What is a Servlet?

A servlet is a Java programming language class that is used in a request-response programming model to expand the functionality of servers accessed by host apps. Although servlets can respond to any form of request, they are typically used to extend web server hosted applications. 

What is the main job of HttpServletRequest and HttpServletResponse?

A Servlet is a Java programming language class that is used to extend the functionality of servers accessed by host apps in a request-response programming model. Although servlets can respond to any type of request, they are usually used to expand applications hosted by the web server. 

Question Two

2 Marks

Learning Outcome(s):

Write XML documents & XML Schema.

Convert the following Menu to XML document (it should be a well-formed XML document):

Answer:

<?xml version="1.0" encoding="UTF-8"?>

<menu>

<Breakfast>

<item>

<name>Shakshuka</name>

<price>35 SAR</price>

<description> Farm eggs served over-easy in tomato-chili sauce oregano,feta,served with flatbread+home fries.</description>

</item>

<item>

<name>Steak n Eggs</name>

<price>45 SAR</price>

<description>Chicken-fried sirloin,rosemary garlic new potatoes,fried egg,Texas toast</description>

</item>

</Breakfast>

<Cafe>

<item>

<name>Espresso</name>

<price>10 SAR</price>

</item>

<item>

<name>Latte</name>

<price>12 SAR</price>

</item>

<item>

<name>Cappuccino</name>

<price>14 SAR</price>

</item>

</Cafe>

<Sides>

<item>

<name>Scrambled Eggs</name>

<price>15 SAR</price>

</item>

<item>

<name>Chips and Salsa</name>

<price>17 SAR</price>

</item>

<item>

<name>French Fries</name>

<price>10 SAR</price>

</item>

<item>

<name>Water</name>

<price>2 SAR</price>

</item>

</Sides>

</menu>

Question Three

2 Marks

Learning Outcome(s):

Build web applications using PHP or similar languages. 

Write a PHP code that displays the following output:

The program will print “Have a good day” if the time is less than 12 PM and will print “have a good night” if it is 12 or more.

Hint: date function in php is date();

Answer:

<?php

function welcome()

{

if(date("H")<12)

{

return "have a good day";

}

elseif(date("H")>=12)

{

return "have a good night";

}

}

echo "Time:".date("h");

echo "<br>";

echo "Date:".date("Y-m-d");

echo "<br>";

echo welcome();

?>

Question Four

1 Marks

Learning Outcome(s):

Build web applications using PHP or similar languages. 

Write a PHP code that displays the following output. You must use arrays to display the course code. Note: You can change the courses based on what you are studying this semester. Hint: create an array, that has all of your courses, and use it to print the courses list.

Answer:

<?php

$courses = ["IT230", "IT448", "IT445", "IT201"];

echo "I am a student at SEU in IT Department<br>";

echo "I am studying in Fall2020 semester the following courses: <br>";

echo "<br>";

foreach ($courses as $item) {

echo "$item"."<br>";

}

?>

it230q2.xml

Shakshuka 35 SAR Farm eggs served over-easy in tomato-chili sauce oregano,feta,served with flatbread+home fries. Steak n Eggs 45 SAR Chicken-fried sirloin,rosemary garlic new potatoes,fried egg,Texas toast Espresso 10 SAR Latte 12 SAR Cappuccino 14 SAR Scrambled Eggs 15 SAR Chips and Salsa 17 SAR French Fries 10 SAR Water 2 SAR