(Solved Homework): 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

Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): 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…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order 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 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.

Homework Ocean
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

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.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents