Save question 1 files in subfolder lastnamefirstnameassignm
? Save question 1 files in subfolder “lastname_firstname_assignment4\\q1\\”. (2 points)
? Create an ASP.NET C# one page web application that displays the cost of a dance ticket as shown. (4 points)
? The use should enter the customer’s age. (3 points)
? The output should be a message telling the user what the customer’s soccer ticket will cost, based on the following criteria: (14 points for logic) o Under age 4 (age < 4), cost is $3 o Between ages 4 and 16, cost is $7 o Older than 16 (age > 16), cost is $9
? Create your page(s) using “’s Dance Ticket Price” as the page title(s). (2 points) 2 CSCI 5060
? Save the first page as Default.aspx. Use a HTML form to capture user input. The output should be displayed on the same page as shown. ASP.NET C# code should be stored in file Default.aspx.cs. (3 points)
? User input should pass input validations (using ASP.NET C# features) as shown. (10 points)
? Create a css file named style.css to format all pages by creating your own layout (no two students should have the same layout). You can use the same (or similar) css file((s) to format all questions. (5 points)
ocalhost/my asp.net/eicando_richard assignmentlq Richard Ricardo\'s Dance Ticket Price This page will decide the cost of Richard\'s dance ticket price based on his customer\'s age. . Under age 4 (age 16) cost is $9.00 Please enter customer\'s age years old Calculate Ticket Price localhost/eny asp_net/ricardo,richard at rovi search Richard Ricardo\'s Dance Ticket Price This page will decide the cost of Richard\'s dance ticket price based on his customer\'s age. . Under age 4 (age 16) cost is $9.00 Please enter customer\'s age years old Calculate Ticket Price Cost of Richard\'s ticket is $3.00Solution
Executable Code
Code
Default.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{}
protected void Button1_Click(object sender, EventArgs e)
{
if (this.textname.text < 4)
this.labeloutput.text = 3;
else if (this.textname.text < 16 && this.textname.text > 4)
this.labeloutput.Text = 7;
else
this.labeloutput.Text = 9;
}
}
}
Default.aspx
<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Default.aspx.cs\" Inherits=\"WebApplication1._Default\" %>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" >
<head runat=\"server\">
<title>Untitled Page</title>
</head>
<body>
<form id=\"form1\" runat=\"server\">
<div>
Age :
<asp:TextBox id=\"textname\" runat=\"server\"></asp:TextBox>
<asp:Button id=\"Button1\" runat=\"server\" Text=\"Button\" />
<br/>
<br/>
<asp:Label id=\"labeloutput\" runat =\"server\" Text=\"Label\"></asp:Label>
</div>
</form>
</body>
</html>


