【发布时间】:2015-08-05 22:21:31
【问题描述】:
我正在尝试让这个程序运行,但没有骰子。我认为它很完美,但缺少一些东西。它应该根据门票的数量和购买的门票类型显示门票的价格,然后显示所有门票的价格和总收入。
namespace stadiumApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label7_Click(object sender, EventArgs e)
{
}
private void calculateRevenue_Click(object sender, EventArgs e)
{
//assigns input to saved memory
string inputA="";
string inputB ="";
string inputC ="";
double ticketsPurchasedB = double.Parse(inputB);
double ticketsPurchasedA = double.Parse(inputA);
double ticketsPurchasedC = double.Parse(inputC);
//price of each ticket grade
double priceA = 15;
double priceB = 12;
double priceC = 9;
//calculations for each class
double calcOutputA = priceA * ticketsPurchasedA ;
string outputA = calcOutputA.ToString();
double calcOutputB = priceB * ticketsPurchasedB;
string outputB = calcOutputB.ToString();
double calcOutputC = priceC * ticketsPurchasedC;
string outputC = calcOutputC.ToString();
//calculations for total revenue
double totalLabelHolder = calcOutputA + calcOutputB + calcOutputC;
//display total
string totalLabel = totalLabelHolder.ToString();
}
}
}
【问题讨论】:
-
这个问题陈述不是很具体。请说明您遇到了什么错误,究竟是什么不起作用,等等。
-
通过一些代码,我们只能说“是的,按书面方式工作”。将其简化为一个最小的示例,说明您想要/期望什么、您得到什么以及您尝试过什么。
标签: c# winforms exception input