visual studio design for calculator <form id=\"form1\" runat=\"server\"> <br />
ID: 3912696 • Letter: V
Question
visual studio design for calculator
<form id="form1" runat="server">
<br />
<br />
<asp:label runat="server" text="Annual Hours:"></asp:label>
<asp:TextBox ID="txtAnnualHours" runat="server"></asp:TextBox>
<p>
</p>
<asp:Label ID="displayRate" runat="server" Text="Pay Rate:"></asp:Label>
<asp:TextBox ID="txtPayRate" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnCalculateSalary" runat="server" Text="Calculate Salary" />
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="$"></asp:Label>
</form>
execute the code when calculate button is pressed and please help me to fix the code below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class frmSalaryCalculator : System.Web.UI.Page
{
public object ErrorMessage { get; private set; }
protected void Page_Load(object sender, EventArgs e)
{
//Clear any error messages
ErrorMessage.Text = "";
//Calculate your annual wage and display it
decimal txtAnnualHours = 0;
//Check if your hourly wage is a valid decimal value
if (Decimal.TryParse(txtAnnualHours.Text, out txtAnnualHours))
{
//Calculate salary and store it within your Salary Textbox (wage times 40 hours per week and 52 weeks)
txtPayRate.Text = (txtAnnualHours * 2080).ToString("C");
}
else
{
//Display an error
ErrorMessage.Text = "Please ensure your hourly wage is a proper decimal value.";
}
}
}
Explanation / Answer
Do a console statement and check for the output.
parse value in exponential notation.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.