得 分 评卷人 四、编写程序题(共10分)

编写工资调整程序。若基本工资大于等于800元,增加工资20%,若小于800元大于600元,则增加工资15%;若小于600元则增加工资10%。要求在文本框Text1中输入某职工的基本工资,单击“计算”按钮,在标签框Label1中输出增加后的工资。程序运行界面如下图所示。===============
要求前台后台代码都有

解决方案 »

  1.   

    Private Sub Command1_Click()
        Dim n As Double
        n = CDbl(Text1)
        If n >= 800 Then
            n = n * 1.2
        ElseIf n < 600 Then
            n = n * 1.1
        Else
            n = n * 1.15
        End If
        Label1.Caption = n
    End Sub
      

  2.   

    图片地址:
    http://photo.store.qq.com/http_imgload.cgi?/rurl2=1a7c8ca9cf85e98e03116941a52487f0d065853731fa7bf1e3cc4dcf5fe5ea33c4fb4b075a700f40240f98257ed6d453799c98e547ce3e53eede1ca95b4ad4a70e26addb597087ee0fdfc86a95eb0a5c426e2253或者点这个超链接 我把图片放在QQ空间里面了
    http://photo.store.qq.com/http_imgload.cgi?/rurl2=1a7c8ca9cf85e98e03116941a52487f0d065853731fa7bf1e3cc4dcf5fe5ea33c4fb4b075a700f40240f98257ed6d453799c98e547ce3e53eede1ca95b4ad4a70e26addb597087ee0fdfc86a95eb0a5c426e2253
      

  3.   

    看不到图片放一文本框,取名Text1
    放一标签,取名Label1
    放一命令按钮, 取名Command1
    再写入以上程序,在文本框输入工资额,点击命令按钮,在标签处显示变动后工资数
    没前台后台
      

  4.   

    VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   2775
       ClientLeft      =   60
       ClientTop       =   450
       ClientWidth     =   3810
       LinkTopic       =   "Form1"
       ScaleHeight     =   2775
       ScaleWidth      =   3810
       StartUpPosition =   3  '窗口缺省
       Begin VB.TextBox Text1 
          Height          =   375
          Left            =   1260
          TabIndex        =   1
          Top             =   480
          Width           =   2055
       End
       Begin VB.CommandButton Command1 
          Caption         =   "计算"
          Height          =   375
          Left            =   840
          TabIndex        =   0
          Top             =   2100
          Width           =   1995
       End
       Begin VB.Label Label2 
          Caption         =   "变动前工资"
          Height          =   315
          Left            =   240
          TabIndex        =   3
          Top             =   540
          Width           =   915
       End
       Begin VB.Label Label1 
          Caption         =   "变动后工资"
          Height          =   435
          Left            =   180
          TabIndex        =   2
          Top             =   1260
          Width           =   3135
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub Command1_Click()
        Dim n As Double
        n = CDbl(Text1)
        If n >= 800 Then
            n = n * 1.2
        ElseIf n < 600 Then
            n = n * 1.1
        Else
            n = n * 1.15
        End If
        Label1.Caption = "变动后工资:" & n
    End Sub