Book Contents

Ch. 11
Building Web-Based and Inter-Organizational Decision Support Systems

# JavaScript Decision Aid Exercise

You have been asked to evaluate a Data Mart project. The initial cost of the Data Mart is \$50,000 with indirect costs of \$25,000. In year 2 of the project analysts estimate direct benefits of only \$5,000, but indirect benefits of \$10,000. In years 2 and 3 the project will involve \$10,000 each year direct and indirect costs. The benefits of the projects won't really start to be realized until year 3 when \$10,000 in direct benefits and \$20,000 in indirect benefits will result. Additional indirect benefits will result in year 4 (\$20,000), year 5 (\$20,000), year 6 (\$20,000), and year 7 (\$10,000). What is your evaluation of this proposed project? What is your recommendation? Use the JavaScript decision aids at DSSResources.COM. They can be found at http://dssresources.com/subscriber/password/decisionaids/index.html. You may want to try the following decision aids:

• Cost/Benefit Analysis (shown in Figure 11.6)
• DSS Project Evaluator
• Multi-Factor Evaluator

Figure 11.6 - Cost/Benefit Analysis

# JavaScript DSS Programming Exercise

Develop a simple Web-Based DSS that converts from Fahrenheit temperatures to Centigrade temperatures. The formula for converting from Fahrenheit to Centigrade is Centigrade Temperature = 5/9 (Fahrenheit Temperature – 32). Use form tags to create input and output fields. Then, write the JavaScript program and include it on your web page. Title the page "Temperature Converter". In the head of the HTML page, include this JavaScript code.

<script language="JavaScript">
function convert() {
var f = eval(document.form.fahrenheit.value);
var c = 5/9*(f-32);
}
</script>

JavaScript is very sensitive to returns and formatting. Be careful that you include all of the code. Create the form in the body of your HTML page and include a heading for the temperature converter. Use the following code. If you change variable names, make sure they correspond to the names in the JavaScript program.

<form method="post" name="form">
Fahrenheit Temperature: <input type="text" name="fahrenheit" size="5"><p>
<input type="button" onClick="convert()" value="Submit">
</form>

OnClick calls the function convert(). The parentheses tell JavaScript that you are calling the function. We use the document object model in the function to read the data and to output it. The HTML page should look something like Figure 11.7:

Figure 11.7 – Screen Shot of Temperature Converter
Exercise created by Alex and Dan Power, 11/12/2000.