Homework J4

Due: Friday, 18 March 2005 by 10 a.m.



Home | Resources | Homeworks | Slides | Labs | Contacts | Submit | Forums | Private

Submission requirements

Observation

Objectives

Disclaimer

As a matter of professional ethics, we make the disclaimer that the tool that you will develop for this assignment is intended solely for pedagogical (teaching) purposes. The design and development of a true diagnostic tool requires interaction with medical personnel, testing in controlled environments to determine the validity of the program, and official certification. For information on the professional code for computer scientists, visit the ACM website www.acm.org. The ACM is the major professional society of computer scientists.

Background

This assignment builds upon the problem solving and class development knowledge and skills that you have obtained by participating in this course. In particular, this assignment has you develop a class for representing and manipulating a medical condition diagnostic tool.

A diagnostic tool is an example of expert systems. An expert system behaves like a human expert for a particular problem domain. The problem domain being considered in this assignment is dizziness.

Expert systems are typically rule-based, where a rule has two components. The first component is the conditions under which the rule is applicable; the second component is the recommended action under those conditions. To determine which rule applies, a rule-based expert system typically performs a series of queries to determine the situation at hand. The queries are normally done in a manner that uses responses from previous queries to determine future queries. Such a process enables the program to determine quickly the specifics of the situation.

Problem statement

The tool you will design and produce is based on the following diagram, which is a simplification of an American Medical Association procedure for dealing with dizziness in their reference The American Medical Association Family Medical Guide: Fourth Edition, Wiley, ISBN 0-471-26911-5, 2004.

Additional specifications

Your solution DizzinessExpert.java must provide the following capabilities:

Based on this specification, we suggest a private String  instance variable recommendation that maintains the current recommendation of the DizzinessExpert. However, it is up to you how to provide the necessary capabilities.

Discussion

The first three methods listed in the requirements have straightforward implementations -- they merely involve the setting or accessing of the recommendation of the DizzinessExpert. The fourth method is more involved -- it requires a decision structure that implements the dizziness diagram.

To ease the implementation burden of the queryUser() method, the solution template file defines a set of String variables representing the various recommendations and interview questions.  We very strongly suggest that use them.

To further ease your implementation burden you are welcomed to use a class Extractor that we have developed. Class Extractor supports the extraction of input. If you choose to download the file Extractor.class, then your DizzinessExpert solution has access to the following Extractor methods (among others).

So what use is Extractor to you? Consider the follow code segment that could begin an implementation of the DizzinessExpert instance method queryUser().

public void queryUser() {
    Extractor stream = new Extractor();

    if ( ! stream.queryForYesOrNo( LIGHT_HEADED_QUESTION )  ) {
        setRecommendation( INSUFFICIENT_ABILITY_DIAGNOSIS );
    } ...

where LIGHT_HEADED_QUESTION and INSUFFICIENT_ABILITY_DIAGNOSIS are String variables defined in the template file and setRecommendation() is your DizzinessExpert method.

Testing

To test your class you should use a method main() that creates and uses a DizzinessExpert . The program could be run multiple times to determine whether each diagnosis is correctly determined.  A sample method main() is

public static void main(String[] args) {

    System.out.println ("\nWelcome to our expert system that will "
        + "diagnose why you are dizzy.\n\n");

    DizzinessExpert expert = new DizzinessExpert();

    expert.queryUser();

    String result = expert.getRecommendation();

    System.out.println ("The diagnosis is: " + result + "\n");
}

Sample output