Answered Essay: Build a one-page application with the user interface that’s shown below. This time, the user will enter the sales price and discount percen

C#

Please help me! Thank you

Build a one-page application with the user interface that’s shown below. This time, the user will enter the sales price and discount percent, and the application will calculate and display the discount amount and total price. If a user entry is invalid, an error message will be displayed to the right of the related text box.

Start a new web site and build the form

Start a new web site named XEx02Quotation in your exercises_extra folder.

Add a web form to the project with the name Default.aspx.

Add an h1 heading to the form element with the text shown above.

Add a table to the form below the heading with 8 rows and 3 columns. (The third column will be used for validation controls.)

Add the text and button shown above to the cells in the first, third, fourth, sixth, and eighth rows of the first column.

Adjust the width of the table by dragging its right handle, and adjust the widths of the columns by dragging their right borders so the widths are similar to what’s shown above. (It may take some time to get this right, and the form may look different in Design view than it does when you run the application.)

Add text boxes to the first and third rows in the second column, and add label controls to the fourth and six rows in the second column.

Use the Properties window to set appropriate IDs for the controls and to format the first text box and the two labels with bold type. Then, use the Properties window to set the text for the button to “Calculate”.

Test this form to see how it looks in a browser, and make whatever adjustments are necessary.

Add the C# code for the form

Create an event handler for the click event of the Calculate button. This handler should calculate the discount amount and total price and display them in currency format as shown above.

Test this form to see whether it works correctly, and make whatever corrections are necessary.

Add validators for the text boxes

Add a required field validator in the column to the right of each text box that tests whether an entry has been made in the text box. If an entry hasn’t been made, “Required” should be displayed.

Add a range validator in the column to the right of each text box. The one for the Sales Price should test to see whether the entry is between 10 and 1000, and an appropriate message should be displayed if it isn’t. The one for the Discount Percent should test whether the entry is between 10 and 50, and an appropriate message should be displayed if it isn’t.

If necessary, adjust the C# code for the page so it only does the calculations if the entries are valid.

Turn off unobtrusive validation for the page. Then, test the application, and make whatever corrections are necessary.

Make any final adjustments

Take a final look at the application, and make any adjustments for improving the look of the application, the operation of the application, or the clarity and logic of the code.

Transfer the website to your Student Serve website WEB180Even.

Expert Answer

 

aspx code of the project:

<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”Default.aspx.cs” Inherits=”XEx02.Default” %>

<!DOCTYPE html>

<html >
<head runat=”server”>
<title></title>
<style type=”text/css”>
.auto-style1 {
width: 56%;
}
.auto-style3 {
width: 186px;
}
.auto-style5 {
width: 152px;
}
.auto-style6 {
width: 140px;
}
</style>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<h1>Price Quotation</h1>
</div>
<table class=”auto-style1″>
<tr>
<td class=”auto-style5″>Sales Price</td>
<td class=”auto-style6″>
<asp:TextBox ID=”salesPrice” runat=”server”></asp:TextBox>

<asp:RangeValidator ID=”RangeValidator1″ runat=”server” ErrorMessage=”10 to 1000 range” MaximumValue=”1000″ MinimumValue=”10″ Type=”Integer” ControlToValidate=”salesPrice”></asp:RangeValidator>

</td>
<td class=”auto-style3″>

<asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server” ErrorMessage=”*Sales Price Required” ControlToValidate=”salesPrice”>

</asp:RequiredFieldValidator>

</td>

</tr>
<tr>
<td class=”auto-style5″>Discount Percent</td>
<td class=”auto-style6″>
<asp:TextBox ID=”discountPercent” runat=”server”></asp:TextBox>

<asp:RangeValidator ID=”RangeValidator2″ runat=”server” ErrorMessage=”10 to 50 range” MaximumValue=”50″ MinimumValue=”10″ Type=”Integer” ControlToValidate=”discountPercent”></asp:RangeValidator>

</td>
<td class=”auto-style3″>

<asp:RequiredFieldValidator ID=”RequiredFieldValidator2″ runat=”server” ErrorMessage=”*Discount Price Required” ControlToValidate=”discountPercent”>

</asp:RequiredFieldValidator>

</td>

</tr>
<tr>
<td class=”auto-style5″>Discount Amount</td>
<td class=”auto-style6″>
<asp:Label ID=”doller” runat=”server” Text=”$” Font-Bold=”True”></asp:Label>
<asp:Label ID=”discountAmount” runat=”server” Font-Bold=”True”></asp:Label>
</td>
<td class=”auto-style3″>

</td>

</tr>
<tr>
<td class=”auto-style5″>Total Price</td>
<td class=”auto-style6″>
<asp:Label ID=”doller1″ runat=”server” Text=”$” Font-Bold=”True”></asp:Label>
<asp:Label ID=”totalPrice” runat=”server” Font-Bold=”True”></asp:Label>
</td>
<td class=”auto-style3″>

</td>

</tr>
</table>
<p>
<asp:Button ID=”Button1″ runat=”server” Text=”Calculate” Width=”100px” OnClick=”Button1_Click” />
</p>
</form>
</body>
</html>

C# code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace XEx02
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
doller.Visible = false;
doller1.Visible = false;

}

protected void Button1_Click(object sender, EventArgs e)
{
doller.Visible = true;
doller1.Visible = true;

double discount=0, total=0;

discount = double.Parse(salesPrice.Text) * double.Parse(discountPercent.Text)/100;

total = double.Parse(salesPrice.Text) – discount;

discountAmount.Text = discount.ToString(“0.00”);
totalPrice.Text = total.ToString(“0.00”);
}
}
}

output:

Note:

20 percent of 500 is 100 so calculated like that.

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?