对第一个程序的改进

原创 2007年10月02日 21:46:00

import java.lang.*;
import javax.swing.*;
/*import java.awt.*;
import java.applet.Applet;*/
public class AnimalIdentify1 {
 public AnimalIdentify1( ) {
 }
 
 /* 规则定义*/
 public  void rule1 ( ){
  int answer=JOptionPane.showConfirmDialog(null,"the animal doesn't have hair? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer==JOptionPane.YES_OPTION) 
     JOptionPane.showMessageDialog(null,"The animal is a mammal","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
   
 }

 public void rule2( ){
  int answer=JOptionPane.showConfirmDialog(null,"the animal doesn't galactopoiesis? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a mammal","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
   
 }  

 public void rule3( ){
  int answer=JOptionPane.showConfirmDialog(null,"the animal doesn't have feather? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a feather","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
   
 
 }
 public void rule4( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal doesn't fly? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't lay Egg? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a feather","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
   
 }
 
 
 public void rule5( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't mammal? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't eat meat? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a carnivore","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
 }
 
 
 public void rule6( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't mammal? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't have claw? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal doesn't have sharptooth? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer4=JOptionPane.showConfirmDialog(null,"the animal isn't eyefrontad? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION&&answer4==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a carnivore","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
 }
 
 
 public void rule7( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't mammal? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't have hoof? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a ungulate","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
 }
  
 
 
    public void rule8( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't mammal? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't ruminate? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a ungulate and cloot","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
 }
  
  
 public void rule9( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't carnivore? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't snuffcolored? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal isn't fuscous fleck? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a leopard","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
 
 
 public void rule10( ){
  int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't carnivore? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't snuffcolored? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal isn't black stripe? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a tiger","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
 
 
    public void rule11( ){
     int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't ungulate? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal doesn't have long leg? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal doesn't have long neck? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer4=JOptionPane.showConfirmDialog(null,"the animal isn't snuffcolored? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer5=JOptionPane.showConfirmDialog(null,"the animal isn't fuscous fleck? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION&&answer4==JOptionPane.YES_OPTION&&answer5==JOptionPane.YES_OPTION)
        JOptionPane.showMessageDialog(null,"The animal is a giraffe","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
    
   
    public void rule12( ){
     int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't ungulate? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't white? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal isn't black stripe? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a zebra","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
    }
   
    public void rule13( ){
     int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't aves? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't notfly? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal doesn't have long leg? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer4=JOptionPane.showConfirmDialog(null,"the animal doesn't have long neck? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer5=JOptionPane.showConfirmDialog(null,"the animal isn't blackandwhite? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION&&answer4==JOptionPane.YES_OPTION&&answer5==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a ostrich","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
   
   
    public void rule14( ){
     int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't aves? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't notfly? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer3=JOptionPane.showConfirmDialog(null,"the animal doesn't swim? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer4=JOptionPane.showConfirmDialog(null,"the animal isn't blackandwhite? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION&&answer3==JOptionPane.YES_OPTION&&answer4==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a penguin","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
     
   
    public void rule15( ){
        int answer1=JOptionPane.showConfirmDialog(null,"the animal isn't aves? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     int answer2=JOptionPane.showConfirmDialog(null,"the animal isn't be good at flying? In(Y/N)","AnimalIdentify",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
     if(answer1==JOptionPane.YES_OPTION&&answer2==JOptionPane.YES_OPTION) 
        JOptionPane.showMessageDialog(null,"The animal is a salangane","AnimalIdentify",JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
 }
  
     
   
   
   
    /*规则查询分析*/
    public void queryUseRule( ){
     JOptionPane.showMessageDialog(null,"please in your observing about the animal","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule1( );
        JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
        rule2( );
         JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule3( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule4( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule5( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule6( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule7( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule8( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule9( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule10( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule11( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule12( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule13( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule14( );
      JOptionPane.showMessageDialog(null,"continue observe","AnimalIdentiy",JOptionPane.INFORMATION_MESSAGE);
     rule15( );
   }
       /*主函数 */
      public static void main (String[ ] args){
       AnimalIdentify1 animal1=new AnimalIdentify1();
       animal1.queryUseRule();
    } 
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

面试题

查询文件空行所在行号1、grep -n "^$" filename2、grep -n ^$ filename3、grep -n ^$ filename |awk -F":" '{print $1}'4...

都是分号惹的祸(ORA-00911: invalid character)

今天在写SQL查询Oracle中的数据时遇到一个问题。在一般的SQL查询分析器中写好的SQL语句(运行一切正常),扔到用C#写的程序中就报错。错误代码如下:System.Data.OleDb.OleD...
  • bruesz
  • bruesz
  • 2008-04-21 09:29
  • 23169

使用axis2进行WebService的开发

Apache Axis2 是 Apache Axis SOAP 项目的后继项目。此项目是 Web 服务核心引擎的重要改进,目标是成为 Web 服务和面向服务的体系结构(Service-Oriented...

WebService学习之旅(四)Apache Axis2的安装

一、Axis2简介 Axis2是目前使用较多的WebService引擎,它是Axis1.x的升级版本,不仅支持SOAP1.1和SOAP1.2,而且也提供了对REST风格WebService的支持。 ...

JAVA_HOME环境配置

java环境变量配置 windows xp下配置JDK环境变量:       1.安装JDK,安装过程中可以自定义安装目录等信息,例如我们选择安装目录为D:\java\jdk1.5.0_08; ...

使用Axis2方式发布webService的三种方式

1、简单的pojo方式: 1.1 功能描述 在Axis2中不需要进行任何的配置,就可以直接将一个简单的POJO发布成WebService。其中POJO中所有的public方法将被发布成WebSe...

webservice--四种客户端调用方式

Webservice的四种客户端调用方式 公网服务地址: http://www.webxml.com.cn/zh_cn/index.aspx 一、生成客户端调用方式 1、Wsimpor...

使用axis2,根据WSDL生成java客户端代码

1、axis2客户端下载地址:http://mirror.esocc.com/apache//axis/axis2/java/core/1.6.2/axis2-1.6.2-bin.zip; 2、下载解...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)