Sub InsurancePlan()

'定义变量
Dim gender As String
Dim age As Integer
Dim paymentPeriod As Integer
Dim insuranceFee As Double
Dim totalBenefit As Double

'获取用户输入
gender = InputBox("请输入性别(男/女):")
age = InputBox("请输入年龄:")
paymentPeriod = InputBox("请输入缴费期间(年):")
insuranceFee = InputBox("请输入保险费:")

'计算利益演示表
totalBenefit = insuranceFee * paymentPeriod * 0.8

'输出利益演示表
MsgBox "尊敬的" & gender & "士,您的利益演示表如下:" & vbCrLf _
& "年龄:" & age & "岁" & vbCrLf _
& "缴费期间:" & paymentPeriod & "年" & vbCrLf _
& "保险费:" & insuranceFee & "元" & vbCrLf _
& "总保险金额:" & totalBenefit & "元"

End Su

写一段VBA代码:输入性别、年龄、缴费期间保险费输出利益演示表

原文地址: https://www.cveoy.top/t/topic/g8s9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录