zoukankan      html  css  js  c++  java
  • Passcal运费计算

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        txtweight: TEdit;
        txtdistence: TEdit;
        txtprice: TEdit;
        resultstr: TButton;
        //procedure TForm1(Sender: TObject);
        procedure resultstrClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.resultstrClick(Sender: TObject);
    var p,w,d,f:real;  s:integer;
    begin
      w:=strtofloat(txtweight.Text);  //货物重量赋值w
      s:=strtoint(txtdistence.Text);    //运输距离赋给s
      p:=strtofloat(txtprice.Text);     //基本费用赋给p
      case s of
        0..249:   d:=0;
        250..499:   d:=0.02;
        500..999:    d:=0.05;
        1000..1999:  d:=0.08;
        2000..2999:   d:=0.1;
      else
        d:=0.15;
      end;
      f:=p*w*s*(1-d);
      resultstr.Caption :='运费为'+floattostr(f)
      
    end;
    
    end.

  • 相关阅读:
    array_merge
    漏斗模型
    3 破解密码,xshell连接
    2-安装linux7
    1-Linux运维人员要求
    17-[模块]-time&datetime
    16-[模块]-导入方式
    Nginx服务器
    15-作业:员工信息表查询
    14-本章总结
  • 原文地址:https://www.cnblogs.com/springcloud/p/15784715.html
Copyright © 2011-2022 走看看