Click the two buttons on the exam to see the output for the two problems
Click "View", the "Source" to see the code
1. (50 points)
There are fifty-two *.png image files that represent the face images of 52 playing cards. The files are named: "1.png", "2.png",...,"52.png". Assume there is an HTML page with a DIV block with id="cout". There is also a javascript function named p1.
Assume there is a global array named cn that has 20 elements. Further assume there is a pre-written javascript function named twenty. This function populates the global cn array with twenty random integer numbers between 1 and 52, inclusive. It assures that: (a) NO integer occurs more than once; (b) the smallest possible integer is 1; and (c) the largest possible integer is 52. NO not write the function twenty, the cn array or any code to populate it.
In the function p1, you are to use the cn array created by twenty to display images for four poker hands of five cards each -- arranged in a cross pattern (see below). There are also two arrays named v_start and h_start that each contain four values as follows:
This is the DIV block with id="cout" |
<XML id="ryder">
<?xml version="1.0"?> <!DOCTYPE ryder_cup [ <!ELEMENT ryder_cup (team+)> <!ELEMENT team (team_name,player+)> <!ELEMENT team_name (#PCDATA)> <!ELEMENT player (first, last, age)> <!ELEMENT first (#PCDATA)> <!ELEMENT last (#PCDATA)> <!ELEMENT age (#PCDATA)> ] <ryder_cup> <team> <team_name>United States Ryder Cup Team</team_name> <player><first>Phil</first> <last>Mickelson</last><age>31</age></player> <player><first>Hunter</first> <last>Mahan</last><age>29</age></player> <player><first>Bubba</first> <last>Watson</last><age>33</age></player> . . . <player><first>Tiger</first> <last>Woods</last><age>36</age></player> <player><first>Zach</first> <last>Johnson</last><age>37</age></player> <player><first>Stewart</first> <last>Cink</last><age>38</age></player> <player><first>Rickie</first> <last>Fowler</last><age>33</age></player> </team> <team> <team_name>European Ryder Cup Team</team_name> <player><first>Lee</first> <last>Westwood</last><age>38</age></player> <player><first>Rory</first> <last>McIlroy</last><age>32</age></player> . . . <player><first>Edoardo</first> <last>Molinari</last><age>30</age></player> <player><first>Luke</first> <last>Donald</last><age>34</age></player> </team> </ryder_cup> </XML> |
2. (50 points) The 2010 Ryder Cup Golf Championship team rosters are stored inside an XML tag with id="ryder. A portion of the xml is shown to the left. When the user clicks this button: , a javascript function p2 is executed. This sub retrieves the XML and creates a 3 column table with a 1 pixel border showing all the teams' data as follows:
Notes:
|