我正在为一个学校项目工作。本质上,该程序应该根据设置的条件确定球员的薪水。要求之一是要有一个标签,显示最高薪水,而球员输入的薪水最高,并继续显示最高薪水,直到表格被清除为止。我在弄清楚如何显示它时遇到了麻烦。那是我需要完成的最后一步。帮助将不胜感激!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TieredPlayerSalaryViaIF
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
const decimal constTier1 = 17500;
const decimal constTier2 = 20000;
const decimal constTier3 = 22500;
const decimal constTier4 = 25000;
private void SalaryButton_Click(object sender, EventArgs e)
{
decimal HitNumber = 0;
decimal SalaryToUse = 0;
decimal SalaryMultiplier = 0;
decimal.TryParse(HitsText.Text, out HitNumber);
HitNumber = decimal.Parse(HitsText.Text);
SalaryToUse = 0;
if (HitNumber < 49)
{
SalaryToUse = HitNumber * constTier1;
}
else if (HitNumber >= 50 && HitNumber < 99)
{
SalaryToUse = HitNumber * constTier2;
}
else if (HitNumber >= 100 && HitNumber < 149)
{
SalaryToUse = HitNumber * constTier3;
}
else
{
SalaryToUse = HitNumber * constTier4;
}
SalaryMultiplier = 0;
if (AllStarCheck.Checked && MVPcheck.Checked)
{
SalaryMultiplier = SalaryToUse * 1.45m;
}
else if (MVPcheck.Checked)
{
SalaryMultiplier = SalaryToUse * 1.20m;
}
else if (AllStarCheck.Checked)
{
SalaryMultiplier = SalaryToUse * 1.25m;
}
else
{
SalaryMultiplier = SalaryToUse;
}
SalaryToUse = SalaryMultiplier;
HighestPlayer.Text = PlayerText.Text;
SalaryLabel.Text = SalaryToUse.ToString("c");
}
}
}