import java.awt.Container;
     
      import javax.swing.*;
     
      public class oo extends JApplet {

       public void init()
       {

          String s1 = JOptionPane.showInputDialog(
             "Enter first floating-point value" );
          String s2 = JOptionPane.showInputDialog(
             "Enter second floating-point value" );
          String s3 = JOptionPane.showInputDialog(
             "Enter third floating-point value" );
   
          double number1 = Double.parseDouble( s1 );
          double number2 = Double.parseDouble( s2 );
          double number3 = Double.parseDouble( s3 );
   
          double max = maximum( number1, number2, number3 );
          JTextArea outputArea = new JTextArea();

          outputArea.setText( "number1: " + number1 + "number2: " +
             number2 + "number3: " + number3 + "maximum is: " + max );
 
          Container container = getContentPane();
   
 
          container.add( outputArea );
   
       }
   
                     
       public double maximum( double x, double y, double z )
       {                                                   
          return Math.max( x, Math.max( y, z ) );          
                                                           
       }                             
   
    } 





記事本








run後打隨便3次數字進去

完成


創作者介紹
創作者 Miti's Blog 的頭像
mitia

Miti's Blog

mitia 發表在 痞客邦 留言(0) 人氣( 63 )