================================================================= Assignment #12 - HTML, Web pages, Style, CSS ================================================================= - Ian! D. Allen - idallen@idallen.ca - www.idallen.com 0. What is the date and room location of your CST8281 Final Exam? 11:30am-2pm Thursday, April 29, 2010, rooms T102A/B/C 1. Write the simplest IF statement (simplify the Boolean logic) for the following programming problem specification: "An order is classified as "stale" if the cost is more than \$10 and the time is more than 90 days. Call the inventory routine if the size is bigger than 10 litres and the order is not stale." stale = cost > 10 AND time > 90 NOT stale = NOT ( cost > 10 AND time > 90 ) = cost <= 10 OR time <= 90 if ( size > 10 AND NOT stale ) CALL inventory(); if ( size > 10 AND ( cost <= 10 OR time <= 90 ) ) CALL inventory(); - the parentheses are required, since AND has precedence 2. Write the simplest IF statement (simplify the Boolean logic) for the following programming problem specification: "An order is classified as "urgent" if the cost is more than \$10 or the time is less than 90 days. Call the notify routine if the cost is more than \$10 and the order is not urgent." Find the bug in the above logic. What is wrong? As a programmer, what would you tell your boss about this specification? urgent = cost > 10 OR time < 90 NOT urgent = NOT ( cost > 10 OR time < 90 ) = cost <= 10 AND time >= 90 if ( cost > 10 AND NOT urgent ) CALL notify(); if ( cost > 10 AND cost <= 10 AND time >= 90 ) CALL notify(); Observe that "cost > 10 AND cost <= 10" is a case of "A AND NOT A", which can never be true. The notify() routine will never execute. The specification is wrong. 3. Create a new assignment directory "public_html/a12". What is the absolute pathname of this directory on the CLS? \$ mkdir public_html/a12 \$ cd public_html/a12 \$ pwd /home/abcd0001/public_html/a12 Answers 4-13 are all found as files created on the Course Linux Server. -- | Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/