You are on page 1of 3

Week 6

Programming Assignment
Exercise 1
Write an XML document describing the exercises in this document: the root element is
<exercises>. The root has an attribute number that has value 1. The root element has three
child elements; <date> that contains as text the date of the exercise, and two <item>
elements for the first two exercises (1--2). Write some text in the <item> elements.
<?xml version="1.0" encoding="utf-8"?>
<exercises>
<date>3 March 2020</date>
<item>programming task 1</item>
<item>programming task 2</item>
</exercises>
<? xml version="1.0" encoding="utf-8"?>
<exercises>
<date>20 December 2022</date>
<item>Assignment 1</item>
<item>Assignment 2</item>
</exercises>
Exercise 2
Write an XML document describing a person: name, occupation, address and hobbies.
Please do not use your own information, you can use fake data. Decide on suitable element
names and nesting. Check your document for well-formedness.
<?xml version="1.0" encoding="utf-8"?>
<person>
<name>
<firstname>Kristodehye</firstname>
<lastname>Bnei Regesh</lastname>
</name>
<occupation>Senior Executive Officer</occupation>
<address>
<street>079 Ahenbrono, Daboase</street>
<suburb>Western Region</suburb>
<city>Tarkoradi</city>
<province>Western Region</province>
<postalcode>00233</postalcode>
<country>Ghana</country>
</address>
<hobbies>
<hobby>Watching Movies</hobby>
<hobby>coding</hobby>
<hobby>Listening to Music</hobby>
</hobbies>
</person>
Exercise 3
Draw a tree that represents the XML document you created in task 2.

Exercise 4
<?xml version="1.0" encoding="utf-8"?>
<!--outlining the program of study of a student-->
<programOfStudy>
<program semester="Spring" year="2019">
<class>
<course1>Elective Mathematics</course1>
<goal>Distinction</goal>
<course2>Business Management</course2>
<goal>Distinction</goal>
</class>
<core>Information and Communication Technology</core>
<major>
<course1>Economics</course1>
<course2>Basic Design Technology</course2>
</major>
</program>
<program semester="Fall" year="2020">
<core1>Integrated Science</core1>
<core2>Biology</core2>
<major>
<course1>Physics</course1>
<course2>Chemistry</course2>
<course3>English</course3>
</major>
</program>
</programOfStudy>

You might also like