Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

been charged with creating a Web page to highlight the features of his home- tow

ID: 3890140 • Letter: B

Question

been charged with creating a Web page to highlight the features of his home- town. Create a Web application using the ASP.NET Web Forms site template that contains details about your hometown. If you would prefer that the mem bers visit another location, you may choose a different locale. Set the properties on the form for the controls so the form is aesthetically pleasing. Be sure to change both background and foreground colors, font size, and type 5. Create a similar application to what you developed in Exercise 4 using the ASP.NET Empty Web Site Template. Include an HTML server control that causes a message to be displayed (on a Label object) when the user clicks a button. The message should include additional details about the locale. 6. Create a dynamic Web site that functions like a calculator. Add features for addition, subtraction, multiplication, division, modulation, and so on Create a Web application that enables the user to enter first name, last name, and e-mail address. Accept those values and store them in a text file. Allow the user to input the path where the file should be stored. After retrieving the values from the user, display on the Web page both the full file path (including the name of the file) and all values stored in the file. Confirm that the values are written to the file. 7. Copyright 2013 Cengage Learning. All Rights Rescrved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the cBook and/on Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights rest Type here to search

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace calc
{
[WebService(Namespace = "mycalculatorexample.org")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class CalcWebService : System.Web.Services.WebService
{
[WebMethod]
public string calculate(string first, string second, char sign)
{
string result;
switch (sign)
{
case '+':
{
result = (Convert.ToInt32(first) + Convert.ToInt32(second)).ToString();
break;
}
case '-':
{
result = (Convert.ToInt32(first) - Convert.ToInt32(second)).ToString();
break;
}
case '*':
{
result = (Convert.ToInt32(first) * Convert.ToInt32(second)).ToString();
break;
}
case '/':
{
result = (Convert.ToInt32(first) / Convert.ToInt32(second)).ToString();
break;
}
case '%':
{
result = (Convert.ToInt32(first) % Convert.ToInt32(second)).ToString();
break;
}
default:
result = "Invalid";
break;
}
return result;
}
}

Now, write the following code in the .cs file.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Calculator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string i, j;
static char c;
private void btnthree_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(3);
}
private void btnone_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(1);
}
private void btntwo_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(2);
}
private void btnfour_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(4);
}
private void btnfive_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(5);
}
private void btnsix_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(6);
}
private void btnseven_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(7);
}
private void btneight_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(8);
}
private void btnnine_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(9);
}
private void btnzero_Click(object sender, EventArgs e)
{
textBox1.Text += Convert.ToString(0);
}
private void btnplus_Click(object sender, EventArgs e)
{
i = textBox1.Text;
textBox1.Text = "";
c = '+';
}
private void btnminuse_Click(object sender, EventArgs e)
{
i = textBox1.Text;
textBox1.Text = "";
c = '-';
}
private void btnmultiply_Click(object sender, EventArgs e)
{
i = textBox1.Text;
textBox1.Text = "";
c = '*';
}
private void btndivide_Click(object sender, EventArgs e)
{
i = textBox1.Text;
textBox1.Text = "";
c = '/';
}
private void btnmodulo_Click(object sender, EventArgs e)
{
i = textBox1.Text;
textBox1.Text = "";
c = '%';
}
private void btnequal_Click(object sender, EventArgs e)
{
j = textBox1.Text;
calclocalhost.CalcWebService obj = new calclocalhost.CalcWebService();
textBox1.Text = obj.calculate(i, j, c);
}
}
}