0% found this document useful (0 votes)
40 views3 pages

Week 6

The document outlines 4 exercises for a programming assignment. Exercise 1 instructs the student to write an XML document with a root element of <exercises> containing a <date> element and two <item> elements. Exercise 2 instructs the student to write an XML document describing a person with elements such as <name>, <occupation>, and <address>. Exercise 3 instructs the student to draw a tree representing the XML document from Exercise 2. Exercise 4 provides an example XML document outlining a student's program of study with elements such as <program>, <class>, <core>, and <major>.

Uploaded by

oppong dominic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

Week 6

The document outlines 4 exercises for a programming assignment. Exercise 1 instructs the student to write an XML document with a root element of <exercises> containing a <date> element and two <item> elements. Exercise 2 instructs the student to write an XML document describing a person with elements such as <name>, <occupation>, and <address>. Exercise 3 instructs the student to draw a tree representing the XML document from Exercise 2. Exercise 4 provides an example XML document outlining a student's program of study with elements such as <program>, <class>, <core>, and <major>.

Uploaded by

oppong dominic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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